Skip to content
Snippets Groups Projects
ltmain.sh 179 KiB
Newer Older
  • Learn to ignore specific revisions
  •       -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
          exit $EXIT_FAILURE
        fi
    
    
        rmdirs=
    
        origobjdir="$objdir"
        for file in $files; do
    
          dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
          if test "X$dir" = "X$file"; then
    	dir=.
    
    	objdir="$origobjdir"
          else
    	objdir="$dir/$origobjdir"
          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.
    
    	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
    	  . $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"
    
    	  test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
    
    	  if test "$mode" = uninstall; then
    
    	    if test -n "$library_names"; then
    	      # Do each command in the postuninstall commands.
    
    	      cmds=$postuninstall_cmds
    	      save_ifs="$IFS"; IFS='~'
    	      for cmd in $cmds; do
    		IFS="$save_ifs"
    		eval cmd=\"$cmd\"
    		$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.
    
    	      cmds=$old_postuninstall_cmds
    	      save_ifs="$IFS"; IFS='~'
    	      for cmd in $cmds; do
    		IFS="$save_ifs"
    		eval cmd=\"$cmd\"
    		$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.
    
    	fi
    	;;
    
          *.lo)
    	# Possibly a libtool object, so verify it.
    
    	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
    
    
    	  # 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
    	fi
    	;;
    
          *)
    	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
    
    
    	    # 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
    	  fi
    	fi
    	;;
          esac
    
          $show "$rm $rmfiles"
          $run $rm $rmfiles || exit_status=1
    
        done
        objdir="$origobjdir"
    
        # 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
    
      "")
        $echo "$modename: you must specify a MODE" 1>&2
        $echo "$generic_help" 1>&2
        exit $EXIT_FAILURE
        ;;
      esac
    
      if test -z "$exec_cmd"; then
        $echo "$modename: invalid operation mode \`$mode'" 1>&2
        $echo "$generic_help" 1>&2
        exit $EXIT_FAILURE
      fi
    fi # test -z "$show_help"
    
    
    if test -n "$exec_cmd"; then
    
    # 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
        --tag=TAG         use configuration variables from tag TAG
        --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
    a more detailed description of MODE.
    
    Report bugs to <bug-libtool@gnu.org>."
      exit $EXIT_SUCCESS
      ;;
    
    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
    
    		    try to export only the symbols listed in SYMFILE
    
      -export-symbols-regex REGEX
    
    		    try to export only the symbols matching REGEX
    
      -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
      -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
      -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
    
      -static           do not do any dynamic linking of libtool libraries
    
      -version-info CURRENT[:REVISION[:AGE]]
    
    		    specify library version info [each variable defaults to 0]
    
    
    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
      exit $EXIT_FAILURE
      ;;
    esac
    
    $echo
    $echo "Try \`$modename --help' for more information about other modes."
    
    
    exit $EXIT_SUCCESS
    
    
    # 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
    
    build_libtool_libs=no
    build_old_libs=yes
    
    # ### END LIBTOOL TAG CONFIG: disable-shared
    
    # ### BEGIN LIBTOOL TAG CONFIG: disable-static
    
    build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
    
    # ### END LIBTOOL TAG CONFIG: disable-static
    
    # Local Variables:
    # mode:shell-script
    # sh-indentation:2
    # End: