| [= AutoGen5 Template in=newltmain.in =] |
| [=( dne "# " "# " )=] |
| # |
| # ltmain.sh - Provide generalized library-building support services. |
| # NOTE: Changing this file will not affect anything until you rerun configure. |
| # |
| # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 |
| # Free Software Foundation, Inc. |
| # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
| # Massively rewritten by Bruce Korb <bkorb@gnu.org> |
| # |
| # This program is free software; you can redistribute it and/or modify |
| # it under the terms of the GNU General Public License as published by |
| # the Free Software Foundation; either version 2 of the License, or |
| # (at your option) any later version. |
| # |
| # This program is distributed in the hope that it will be useful, but |
| # WITHOUT ANY WARRANTY; without even the implied warranty of |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| # General Public License for more details. |
| # |
| # You should have received a copy of the GNU General Public License |
| # along with this program; if not, write to the Free Software |
| # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| # |
| # As a special exception to the GNU General Public License, if you |
| # distribute this file as part of a program that contains a |
| # configuration script generated by Autoconf, you may include it under |
| # the same distribution terms that you use for the rest of that program. |
| |
| # Check that we have a working $echo. |
| if test "X$1" = X--no-reexec; then |
| # Discard the --no-reexec flag, and continue. |
| shift |
| elif test "X$1" = X--fallback-echo; then |
| # Avoid inline document here, it may be left over |
| : |
| elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then |
| # Yippee, $echo works! |
| : |
| else |
| # Restart under the correct shell, and then maybe $echo will work. |
| exec $SHELL "$0" --no-reexec ${1+"$@"} |
| fi |
| |
| if test "X$1" = X--fallback-echo; then |
| # used as fallback echo |
| shift |
| cat <<EOF |
| $* |
| EOF |
| exit 0 |
| fi |
| |
| # The name of this program. |
| progname=`$echo "$0" | ${SED} 's%^.*/%%'` |
| modename="$progname" |
| |
| # Constants. |
| PROGRAM=ltmain.sh |
| PACKAGE=@PACKAGE@ |
| VERSION=@VERSION@ |
| TIMESTAMP="@TIMESTAMP@" |
| |
| default_mode= |
| help="Try \`$progname --help' for more information." |
| |
| [= INCLUDE "base-txt.tpl" =] |
| |
| if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
| echo "$modename: not configured to build any kind of library" 1>&2 |
| echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
| exit 1 |
| fi |
| |
| # Global variables. |
| mode=$default_mode |
| nonopt= |
| prev= |
| prevopt= |
| run= |
| show="$echo" |
| show_help= |
| execute_dlfiles= |
| |
| # Parse our command line options once, thoroughly. |
| while test "$#" -gt 0 |
| do |
| arg="$1" |
| shift |
| |
| case $arg in |
| -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; |
| *) optarg= ;; |
| esac |
| |
| # If the previous option needs an argument, assign it. |
| if test -n "$prev"; then |
| case $prev in |
| execute_dlfiles) |
| execute_dlfiles="$execute_dlfiles $arg" |
| ;; |
| tag) |
| tagname="$arg" |
| |
| # Check whether tagname contains only valid characters |
| case $tagname in |
| *[!-_A-Za-z0-9,/]*) |
| echo "$progname: invalid tag name: $tagname" 1>&2 |
| exit 1 |
| ;; |
| esac |
| |
| case $tagname in |
| CC) |
| # Don't test for the "default" C tag, as we know, it's there, but |
| # not specially marked. |
| ;; |
| *) |
| if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then |
| taglist="$taglist $tagname" |
| # Evaluate the configuration. |
| eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" |
| else |
| echo "$progname: ignoring unknown tag $tagname" 1>&2 |
| fi |
| ;; |
| esac |
| ;; |
| *) |
| eval "$prev=\$arg" |
| ;; |
| esac |
| |
| prev= |
| prevopt= |
| continue |
| fi |
| |
| # Have we seen a non-optional argument yet? |
| case $arg in |
| --help) |
| show_help=yes |
| ;; |
| |
| --version) |
| echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" |
| echo |
| echo "Copyright 1996, 1997, 1998, 1999, 2000, 2001" |
| echo "Free Software Foundation, Inc." |
| echo "This is free software; see the source for copying conditions. There is NO" |
| echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." |
| exit 0 |
| ;; |
| |
| --config) |
| ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 |
| # Now print the configurations for the tags. |
| for tagname in $taglist; do |
| ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" |
| done |
| exit 0 |
| ;; |
| |
| --debug) |
| echo "$progname: enabling shell trace mode" |
| set -x |
| ;; |
| |
| --dry-run | -n) |
| run=: |
| ;; |
| |
| --features) |
| echo "host: $host" |
| if test "$build_libtool_libs" = yes; then |
| echo "enable shared libraries" |
| else |
| echo "disable shared libraries" |
| fi |
| if test "$build_old_libs" = yes; then |
| echo "enable static libraries" |
| else |
| echo "disable static libraries" |
| fi |
| exit 0 |
| ;; |
| |
| --finish) mode="finish" ;; |
| |
| --mode) prevopt="--mode" prev=mode ;; |
| --mode=*) mode="$optarg" ;; |
| |
| --preserve-dup-deps) duplicate_deps="yes" ;; |
| |
| --quiet | --silent) |
| show=: |
| ;; |
| |
| --tag) prevopt="--tag" prev=tag ;; |
| --tag=*) |
| set tag "$optarg" ${1+"$@"} |
| shift |
| prev=tag |
| ;; |
| |
| -dlopen) |
| prevopt="-dlopen" |
| prev=execute_dlfiles |
| ;; |
| |
| -*) |
| $echo "$modename: unrecognized option \`$arg'" 1>&2 |
| $echo "$help" 1>&2 |
| exit 1 |
| ;; |
| |
| *) |
| nonopt="$arg" |
| break |
| ;; |
| esac |
| done |
| |
| if test -n "$prevopt"; then |
| $echo "$modename: option \`$prevopt' requires an argument" 1>&2 |
| $echo "$help" 1>&2 |
| exit 1 |
| fi |
| |
| # If this variable is set in any of the actions, the command in it |
| # will be execed at the end. This prevents here-documents from being |
| # left over by shells. |
| exec_cmd= |
| |
| if test -z "$show_help"; then |
| |
| # Infer the operation mode. |
| if test -z "$mode"; then |
| case $nonopt in |
| *cc | *++ | gcc* | *-gcc*) |
| mode=link |
| for arg |
| do |
| case $arg in |
| -c) |
| mode=compile |
| break |
| ;; |
| esac |
| done |
| ;; |
| *db | *dbx | *strace | *truss) |
| mode=execute |
| ;; |
| *install*|cp|mv) |
| mode=install |
| ;; |
| *rm) |
| mode=uninstall |
| ;; |
| *) |
| # If we have no mode, but dlfiles were specified, then do execute mode. |
| test -n "$execute_dlfiles" && mode=execute |
| |
| # Just use the default operation mode. |
| if test -z "$mode"; then |
| if test -n "$nonopt"; then |
| $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 |
| else |
| $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 |
| fi |
| fi |
| ;; |
| esac |
| fi |
| |
| # Only execute mode is allowed to have -dlopen flags. |
| if test -n "$execute_dlfiles" && test "$mode" != execute; then |
| $echo "$modename: unrecognized option \`-dlopen'" 1>&2 |
| $echo "$help" 1>&2 |
| exit 1 |
| fi |
| |
| # Change the help message to a mode-specific one. |
| generic_help="$help" |
| help="Try \`$modename --help --mode=$mode' for more information." |
| |
| # These modes are in order of execution frequency so that they run quickly. |
| case $mode in |
| # libtool compile mode |
| compile) |
| modename="$modename: compile" |
| |
| [= INCLUDE "compile-txt.tpl" =] |
| |
| exit 0 |
| ;; |
| |
| # libtool link mode |
| link | relink) |
| modename="$modename: link" |
| [= INCLUDE "link-txt.tpl" =] |
| exit 0 |
| ;; |
| |
| # libtool install mode |
| install) |
| modename="$modename: install" |
| |
| [= INCLUDE "install-txt.tpl" =] |
| ;; |
| |
| # libtool finish mode |
| finish) |
| modename="$modename: finish" |
| [= INCLUDE "finish-txt.tpl" =] |
| exit 0 |
| ;; |
| |
| # libtool execute mode |
| execute) |
| modename="$modename: execute" |
| |
| # The first argument is the command name. |
| cmd="$nonopt" |
| [= test-or-exit test = 'test -z "$cmd"' |
| msg = "you must specify a COMMAND" =] |
| [= INCLUDE "execute-txt.tpl" =] |
| ;; |
| |
| # libtool clean and uninstall mode |
| clean | uninstall) |
| modename="$modename: $mode" |
| [= INCLUDE "clean-txt.tpl" =] |
| |
| exit $exit_status |
| ;; |
| |
| "") |
| $echo "$modename: you must specify a MODE" 1>&2 |
| $echo "$generic_help" 1>&2 |
| exit 1 |
| ;; |
| esac |
| |
| if test -z "$exec_cmd"; then |
| $echo "$modename: invalid operation mode \`$mode'" 1>&2 |
| $echo "$generic_help" 1>&2 |
| exit 1 |
| fi |
| fi # test -z "$show_help" |
| |
| if test -n "$exec_cmd"; then |
| eval exec $exec_cmd |
| exit 1 |
| 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 |
| --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." |
| exit 0 |
| ;; |
| |
| 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 |
| -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 1 |
| ;; |
| esac |
| |
| echo |
| $echo "Try \`$modename --help' for more information about other modes." |
| |
| exit 0 |
| |
| # 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: |