ltmain.sh 277 KB
Newer Older
9001
9002
      # Now create the wrapper script.
      func_verbose "creating $output"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9003

9004
9005
9006
9007
9008
9009
9010
9011
      # Quote the relink command for shipping.
      if test -n "$relink_command"; then
	# Preserve any variables that may affect compiler behavior
	for var in $variables_saved_for_relink; do
	  if eval test -z \"\${$var+set}\"; then
	    relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
	  elif eval var_value=\$$var; test -z "$var_value"; then
	    relink_command="$var=; export $var; $relink_command"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9012
	  else
9013
9014
	    func_quote_for_eval "$var_value"
	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9015
	  fi
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
	done
	relink_command="(cd `pwd`; $relink_command)"
	relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
      fi

      # Only actually do things if not in dry run mode.
      $opt_dry_run || {
	# win32 will think the script is a binary if it has
	# a .exe suffix, so we strip it off here.
	case $output in
	  *.exe) func_stripname '' '.exe' "$output"
	         output=$func_stripname_result ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9028
	esac
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
	# test for cygwin because mv fails w/o .exe extensions
	case $host in
	  *cygwin*)
	    exeext=.exe
	    func_stripname '' '.exe' "$outputname"
	    outputname=$func_stripname_result ;;
	  *) exeext= ;;
	esac
	case $host in
	  *cygwin* | *mingw* )
	    func_dirname_and_basename "$output" "" "."
	    output_name=$func_basename_result
	    output_path=$func_dirname_result
	    cwrappersource="$output_path/$objdir/lt-$output_name.c"
	    cwrapper="$output_path/$output_name.exe"
	    $RM $cwrappersource $cwrapper
	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15

	    func_emit_cwrapperexe_src > $cwrappersource

	    # The wrapper executable is built using the $host compiler,
	    # because it contains $host paths and files. If cross-
	    # compiling, it, like the target executable, must be
	    # executed on the $host or under an emulation environment.
	    $opt_dry_run || {
	      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
	      $STRIP $cwrapper
	    }
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9057

9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
	    # Now, create the wrapper script for func_source use:
	    func_ltwrapper_scriptname $cwrapper
	    $RM $func_ltwrapper_scriptname_result
	    trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
	    $opt_dry_run || {
	      # note: this script will not be executed, so do not chmod.
	      if test "x$build" = "x$host" ; then
		$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
	      else
		func_emit_wrapper no > $func_ltwrapper_scriptname_result
	      fi
	    }
	  ;;
	  * )
	    $RM $output
	    trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9074

9075
9076
9077
9078
9079
9080
9081
9082
	    func_emit_wrapper no > $output
	    chmod +x $output
	  ;;
	esac
      }
      exit $EXIT_SUCCESS
      ;;
    esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9083

9084
9085
    # See if we need to build an old-fashioned archive.
    for oldlib in $oldlibs; do
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9086

9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
      if test "$build_libtool_libs" = convenience; then
	oldobjs="$libobjs_save $symfileobj"
	addlibs="$convenience"
	build_libtool_libs=no
      else
	if test "$build_libtool_libs" = module; then
	  oldobjs="$libobjs_save"
	  build_libtool_libs=no
	else
	  oldobjs="$old_deplibs $non_pic_objects"
	  if test "$preload" = yes && test -f "$symfileobj"; then
	    func_append oldobjs " $symfileobj"
	  fi
	fi
	addlibs="$old_convenience"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9102
9103
      fi

9104
9105
9106
      if test -n "$addlibs"; then
	gentop="$output_objdir/${outputname}x"
	func_append generated " $gentop"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9107

9108
9109
9110
	func_extract_archives $gentop $addlibs
	func_append oldobjs " $func_extract_archives_result"
      fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9111

9112
9113
9114
9115
      # Do each command in the archive commands.
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
	cmds=$old_archive_from_new_cmds
      else
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9116

9117
9118
9119
9120
	# Add any objects from preloaded convenience libraries
	if test -n "$dlprefiles"; then
	  gentop="$output_objdir/${outputname}x"
	  func_append generated " $gentop"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9121

9122
9123
9124
	  func_extract_archives $gentop $dlprefiles
	  func_append oldobjs " $func_extract_archives_result"
	fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9125

9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
	# POSIX demands no paths to be encoded in archives.  We have
	# to avoid creating archives with duplicate basenames if we
	# might have to extract them afterwards, e.g., when creating a
	# static archive out of a convenience library, or when linking
	# the entirety of a libtool archive into another (currently
	# not supported by libtool).
	if (for obj in $oldobjs
	    do
	      func_basename "$obj"
	      $ECHO "$func_basename_result"
	    done | sort | sort -uc >/dev/null 2>&1); then
	  :
	else
	  echo "copying selected object files to avoid basename conflicts..."
	  gentop="$output_objdir/${outputname}x"
	  func_append generated " $gentop"
	  func_mkdir_p "$gentop"
	  save_oldobjs=$oldobjs
	  oldobjs=
	  counter=1
	  for obj in $save_oldobjs
	  do
	    func_basename "$obj"
	    objbase="$func_basename_result"
	    case " $oldobjs " in
	    " ") oldobjs=$obj ;;
	    *[\ /]"$objbase "*)
	      while :; do
		# Make sure we don't pick an alternate name that also
		# overlaps.
		newobj=lt$counter-$objbase
		func_arith $counter + 1
		counter=$func_arith_result
		case " $oldobjs " in
		*[\ /]"$newobj "*) ;;
		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
		esac
	      done
	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
	      func_append oldobjs " $gentop/$newobj"
	      ;;
	    *) func_append oldobjs " $obj" ;;
	    esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9169
9170
	  done
	fi
9171
9172
	func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
	tool_oldlib=$func_to_tool_file_result
9173
	eval cmds=\"$old_archive_cmds\"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9174

9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
	func_len " $cmds"
	len=$func_len_result
	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
	  cmds=$old_archive_cmds
	elif test -n "$archiver_list_spec"; then
	  func_verbose "using command file archive linking..."
	  for obj in $oldobjs
	  do
	    func_to_tool_file "$obj"
	    $ECHO "$func_to_tool_file_result"
	  done > $output_objdir/$libname.libcmd
	  func_to_tool_file "$output_objdir/$libname.libcmd"
	  oldobjs=" $archiver_list_spec$func_to_tool_file_result"
	  cmds=$old_archive_cmds
	else
	  # the command line is too long to link in one step, link in parts
	  func_verbose "using piecewise archive linking..."
	  save_RANLIB=$RANLIB
	  RANLIB=:
	  objlist=
	  concat_cmds=
	  save_oldobjs=$oldobjs
	  oldobjs=
	  # Is there a better way of finding the last object in the list?
	  for obj in $save_oldobjs
	  do
	    last_oldobj=$obj
	  done
	  eval test_cmds=\"$old_archive_cmds\"
	  func_len " $test_cmds"
	  len0=$func_len_result
	  len=$len0
	  for obj in $save_oldobjs
	  do
	    func_len " $obj"
	    func_arith $len + $func_len_result
	    len=$func_arith_result
	    func_append objlist " $obj"
	    if test "$len" -lt "$max_cmd_len"; then
	      :
	    else
	      # the above command should be used before it gets too long
	      oldobjs=$objlist
	      if test "$obj" = "$last_oldobj" ; then
		RANLIB=$save_RANLIB
	      fi
	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
	      objlist=
	      len=$len0
	    fi
	  done
	  RANLIB=$save_RANLIB
	  oldobjs=$objlist
	  if test "X$oldobjs" = "X" ; then
	    eval cmds=\"\$concat_cmds\"
	  else
	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
	  fi
	fi
      fi
      func_execute_cmds "$cmds" 'exit $?'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9237
9238
    done

9239
9240
    test -n "$generated" && \
      func_show_eval "${RM}r$generated"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9241

9242
9243
9244
9245
9246
9247
    # Now create the libtool archive.
    case $output in
    *.la)
      old_library=
      test "$build_old_libs" = yes && old_library="$libname.$libext"
      func_verbose "creating $output"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9248

9249
9250
9251
9252
9253
9254
      # Preserve any variables that may affect compiler behavior
      for var in $variables_saved_for_relink; do
	if eval test -z \"\${$var+set}\"; then
	  relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
	elif eval var_value=\$$var; test -z "$var_value"; then
	  relink_command="$var=; export $var; $relink_command"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9255
	else
9256
9257
	  func_quote_for_eval "$var_value"
	  relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9258
	fi
9259
9260
9261
9262
9263
9264
9265
      done
      # Quote the link command for shipping.
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
      if test "$hardcode_automatic" = yes ; then
	relink_command=
      fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9266

9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
      # Only create the output if not a dry run.
      $opt_dry_run || {
	for installed in no yes; do
	  if test "$installed" = yes; then
	    if test -z "$install_libdir"; then
	      break
	    fi
	    output="$output_objdir/$outputname"i
	    # Replace all uninstalled libtool libraries with the installed ones
	    newdependency_libs=
	    for deplib in $dependency_libs; do
	      case $deplib in
	      *.la)
		func_basename "$deplib"
		name="$func_basename_result"
9282
9283
		func_resolve_sysroot "$deplib"
		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
		test -z "$libdir" && \
		  func_fatal_error "\`$deplib' is not a valid libtool archive"
		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
		;;
	      -L*)
		func_stripname -L '' "$deplib"
		func_replace_sysroot "$func_stripname_result"
		func_append newdependency_libs " -L$func_replace_sysroot_result"
		;;
	      -R*)
		func_stripname -R '' "$deplib"
		func_replace_sysroot "$func_stripname_result"
		func_append newdependency_libs " -R$func_replace_sysroot_result"
		;;
	      *) func_append newdependency_libs " $deplib" ;;
	      esac
	    done
	    dependency_libs="$newdependency_libs"
	    newdlfiles=

	    for lib in $dlfiles; do
	      case $lib in
	      *.la)
	        func_basename "$lib"
		name="$func_basename_result"
		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
		test -z "$libdir" && \
		  func_fatal_error "\`$lib' is not a valid libtool archive"
		func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
		;;
	      *) func_append newdlfiles " $lib" ;;
	      esac
	    done
	    dlfiles="$newdlfiles"
	    newdlprefiles=
	    for lib in $dlprefiles; do
	      case $lib in
	      *.la)
		# Only pass preopened files to the pseudo-archive (for
		# eventual linking with the app. that links it) if we
		# didn't already link the preopened objects directly into
		# the library:
		func_basename "$lib"
		name="$func_basename_result"
		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
		test -z "$libdir" && \
		  func_fatal_error "\`$lib' is not a valid libtool archive"
		func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
		;;
	      esac
	    done
	    dlprefiles="$newdlprefiles"
	  else
	    newdlfiles=
	    for lib in $dlfiles; do
	      case $lib in
		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
		*) abs=`pwd`"/$lib" ;;
	      esac
	      func_append newdlfiles " $abs"
	    done
	    dlfiles="$newdlfiles"
	    newdlprefiles=
	    for lib in $dlprefiles; do
	      case $lib in
		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
		*) abs=`pwd`"/$lib" ;;
	      esac
	      func_append newdlprefiles " $abs"
	    done
	    dlprefiles="$newdlprefiles"
	  fi
	  $RM $output
	  # place dlname in correct position for cygwin
	  # In fact, it would be nice if we could use this code for all target
	  # systems that can't hard-code library paths into their executables
	  # and that have no shared library path variable independent of PATH,
	  # but it turns out we can't easily determine that from inspecting
	  # libtool variables, so we have to hard-code the OSs to which it
	  # applies here; at the moment, that means platforms that use the PE
	  # object format with DLL files.  See the long comment at the top of
	  # tests/bindir.at for full details.
	  tdlname=$dlname
	  case $host,$output,$installed,$module,$dlname in
	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
	      # If a -bindir argument was supplied, place the dll there.
	      if test "x$bindir" != x ;
	      then
		func_relative_path "$install_libdir" "$bindir"
		tdlname=$func_relative_path_result$dlname
	      else
		# Otherwise fall back on heuristic.
		tdlname=../bin/$dlname
	      fi
	      ;;
	  esac
	  $ECHO > $output "\
# $outputname - a libtool library file
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9386

9387
9388
# The name that we can dlopen(3).
dlname='$tdlname'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9389

9390
9391
# Names of this library.
library_names='$library_names'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9392

9393
9394
# The name of the static archive.
old_library='$old_library'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9395

9396
9397
# Linker flags that can not go in dependency_libs.
inherited_linker_flags='$new_inherited_linker_flags'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9398

9399
9400
# Libraries that this one depends upon.
dependency_libs='$dependency_libs'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9401

9402
9403
# Names of additional weak libraries provided by this library
weak_library_names='$weak_libs'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9404

9405
9406
9407
9408
# Version information for $libname.
current=$current
age=$age
revision=$revision
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9409

9410
9411
# Is this an already installed library?
installed=$installed
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9412

9413
9414
# Should we warn about portability when linking against -modules?
shouldnotlink=$module
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9415

9416
9417
9418
# Files to dlopen/dlpreopen
dlopen='$dlfiles'
dlpreopen='$dlprefiles'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9419

9420
9421
9422
9423
9424
9425
9426
9427
# Directory that this library needs to be installed in:
libdir='$install_libdir'"
	  if test "$installed" = no && test "$need_relink" = yes; then
	    $ECHO >> $output "\
relink_command=\"$relink_command\""
	  fi
	done
      }
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9428

9429
9430
9431
9432
9433
9434
9435
      # Do a symbolic link so that the libtool archive can be found in
      # LD_LIBRARY_PATH before the program is installed.
      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
      ;;
    esac
    exit $EXIT_SUCCESS
}
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9436

9437
9438
{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
    func_mode_link ${1+"$@"}
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9439
9440


9441
9442
9443
9444
9445
# func_mode_uninstall arg...
func_mode_uninstall ()
{
    $opt_debug
    RM="$nonopt"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
    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
9457
9458
9459
      -f) func_append RM " $arg"; rmforce=yes ;;
      -*) func_append RM " $arg" ;;
      *) func_append files " $arg" ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9460
9461
9462
      esac
    done

9463
9464
    test -z "$RM" && \
      func_fatal_help "you must specify an RM program"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9465
9466
9467
9468

    rmdirs=

    for file in $files; do
9469
9470
9471
9472
      func_dirname "$file" "" "."
      dir="$func_dirname_result"
      if test "X$dir" = X.; then
	odir="$objdir"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9473
      else
9474
	odir="$dir/$objdir"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9475
      fi
9476
9477
9478
      func_basename "$file"
      name="$func_basename_result"
      test "$opt_mode" = uninstall && odir="$dir"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9479

9480
9481
      # Remember odir for removal later, being careful to avoid duplicates
      if test "$opt_mode" = clean; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9482
	case " $rmdirs " in
9483
9484
	  *" $odir "*) ;;
	  *) func_append rmdirs " $odir" ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9485
9486
9487
9488
	esac
      fi

      # Don't error if the file doesn't exist and rm -f was used.
9489
9490
9491
      if { test -L "$file"; } >/dev/null 2>&1 ||
	 { test -h "$file"; } >/dev/null 2>&1 ||
	 test -f "$file"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
	:
      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.
9505
9506
	if func_lalib_p "$file"; then
	  func_source $dir/$name
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9507
9508
9509

	  # Delete the libtool libraries and symlinks.
	  for n in $library_names; do
9510
	    func_append rmfiles " $odir/$n"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9511
	  done
9512
	  test -n "$old_library" && func_append rmfiles " $odir/$old_library"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9513

9514
	  case "$opt_mode" in
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9515
	  clean)
9516
	    case " $library_names " in
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9517
	    *" $dlname "*) ;;
9518
	    *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9519
	    esac
9520
	    test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9521
9522
	    ;;
	  uninstall)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9523
9524
	    if test -n "$library_names"; then
	      # Do each command in the postuninstall commands.
9525
	      func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9526
9527
9528
9529
	    fi

	    if test -n "$old_library"; then
	      # Do each command in the old_postuninstall commands.
9530
	      func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9531
9532
	    fi
	    # FIXME: should reinstall the best remaining shared library.
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9533
9534
	    ;;
	  esac
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9535
9536
9537
9538
	fi
	;;

      *.lo)
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9539
	# Possibly a libtool object, so verify it.
9540
	if func_lalib_p "$file"; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9541
9542

	  # Read the .lo file
9543
	  func_source $dir/$name
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9544
9545

	  # Add PIC object to the list of files to remove.
9546
9547
9548
	  if test -n "$pic_object" &&
	     test "$pic_object" != none; then
	    func_append rmfiles " $dir/$pic_object"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9549
9550
9551
	  fi

	  # Add non-PIC object to the list of files to remove.
9552
9553
9554
	  if test -n "$non_pic_object" &&
	     test "$non_pic_object" != none; then
	    func_append rmfiles " $dir/$non_pic_object"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9555
	  fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9556
9557
9558
9559
	fi
	;;

      *)
9560
	if test "$opt_mode" = clean ; then
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9561
9562
9563
	  noexename=$name
	  case $file in
	  *.exe)
9564
9565
9566
9567
	    func_stripname '' '.exe' "$file"
	    file=$func_stripname_result
	    func_stripname '' '.exe' "$name"
	    noexename=$func_stripname_result
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9568
9569
	    # $file with .exe has already been added to rmfiles,
	    # add $file without .exe
9570
	    func_append rmfiles " $file"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9571
9572
9573
	    ;;
	  esac
	  # Do a test to see if this is a libtool program.
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
	  if func_ltwrapper_p "$file"; then
	    if func_ltwrapper_executable_p "$file"; then
	      func_ltwrapper_scriptname "$file"
	      relink_command=
	      func_source $func_ltwrapper_scriptname_result
	      func_append rmfiles " $func_ltwrapper_scriptname_result"
	    else
	      relink_command=
	      func_source $dir/$noexename
	    fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9584

Emmanuel Bertin's avatar
Emmanuel Bertin committed
9585
9586
	    # note $name still contains .exe if it was in $file originally
	    # as does the version of $file that was added into $rmfiles
9587
	    func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9588
	    if test "$fast_install" = yes && test -n "$relink_command"; then
9589
	      func_append rmfiles " $odir/lt-$name"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9590
9591
	    fi
	    if test "X$noexename" != "X$name" ; then
9592
	      func_append rmfiles " $odir/lt-${noexename}.c"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9593
	    fi
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9594
9595
9596
9597
	  fi
	fi
	;;
      esac
9598
      func_show_eval "$RM $rmfiles" 'exit_status=1'
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9599
9600
9601
9602
9603
    done

    # Try to remove the ${objdir}s in the directories where we deleted files
    for dir in $rmdirs; do
      if test -d "$dir"; then
9604
	func_show_eval "rmdir $dir >/dev/null 2>&1"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9605
9606
9607
9608
      fi
    done

    exit $exit_status
9609
}
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9610

9611
9612
{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
    func_mode_uninstall ${1+"$@"}
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9613

9614
9615
9616
9617
9618
9619
9620
test -z "$opt_mode" && {
  help="$generic_help"
  func_fatal_help "you must specify a MODE"
}

test -z "$exec_cmd" && \
  func_fatal_help "invalid operation mode \`$opt_mode'"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9621
9622

if test -n "$exec_cmd"; then
9623
  eval exec "$exec_cmd"
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9624
  exit $EXIT_FAILURE
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9625
9626
fi

9627
exit $exit_status
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9628

Emmanuel Bertin's avatar
Emmanuel Bertin committed
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641

# 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
9642
9643
build_libtool_libs=no
build_old_libs=yes
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9644
9645
9646
# ### END LIBTOOL TAG CONFIG: disable-shared

# ### BEGIN LIBTOOL TAG CONFIG: disable-static
9647
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9648
# ### END LIBTOOL TAG CONFIG: disable-static
Emmanuel Bertin's avatar
Emmanuel Bertin committed
9649
9650
9651
9652
9653

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