Annotation of libwww/config/ltmain.sh, revision 1.6

1.1       frystyk     1: # ltmain.sh - Provide generalized library-building support services.
1.2       frystyk     2: # NOTE: Changing this file will not affect anything until you rerun ltconfig.
                      3: #
1.4       frystyk     4: # Copyright (C) 1996-1999 Free Software Foundation, Inc.
1.5       frystyk     5: # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
1.1       frystyk     6: #
                      7: # This program is free software; you can redistribute it and/or modify
                      8: # it under the terms of the GNU General Public License as published by
                      9: # the Free Software Foundation; either version 2 of the License, or
                     10: # (at your option) any later version.
                     11: #
                     12: # This program is distributed in the hope that it will be useful, but
                     13: # WITHOUT ANY WARRANTY; without even the implied warranty of
                     14: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
                     15: # General Public License for more details.
                     16: #
                     17: # You should have received a copy of the GNU General Public License
                     18: # along with this program; if not, write to the Free Software
                     19: # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
                     20: #
                     21: # As a special exception to the GNU General Public License, if you
                     22: # distribute this file as part of a program that contains a
                     23: # configuration script generated by Autoconf, you may include it under
                     24: # the same distribution terms that you use for the rest of that program.
                     25: 
1.3       frystyk    26: # Check that we have a working $echo.
                     27: if test "X$1" = X--no-reexec; then
                     28:   # Discard the --no-reexec flag, and continue.
                     29:   shift
1.4       frystyk    30: elif test "X$1" = X--fallback-echo; then
1.5       frystyk    31:   # Avoid inline document here, it may be left over
                     32:   :
                     33: elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
                     34:   # Yippee, $echo works!
                     35:   :
                     36: else
                     37:   # Restart under the correct shell, and then maybe $echo will work.
                     38:   exec $SHELL "$0" --no-reexec ${1+"$@"}
                     39: fi
                     40: 
                     41: if test "X$1" = X--fallback-echo; then
1.4       frystyk    42:   # used as fallback echo
                     43:   shift
                     44:   cat <<EOF
                     45: $*
                     46: EOF
                     47:   exit 0
1.3       frystyk    48: fi
                     49: 
1.1       frystyk    50: # The name of this program.
1.2       frystyk    51: progname=`$echo "$0" | sed 's%^.*/%%'`
                     52: modename="$progname"
1.1       frystyk    53: 
                     54: # Constants.
                     55: PROGRAM=ltmain.sh
                     56: PACKAGE=libtool
1.6     ! frystyk    57: VERSION=1.3.2
        !            58: TIMESTAMP=" (1.385.2.150 1999/05/26 00:28:32)"
1.1       frystyk    59: 
                     60: default_mode=
                     61: help="Try \`$progname --help' for more information."
                     62: magic="%%%MAGIC variable%%%"
                     63: mkdir="mkdir"
                     64: mv="mv -f"
                     65: rm="rm -f"
                     66: 
1.2       frystyk    67: # Sed substitution that helps us do robust quoting.  It backslashifies
                     68: # metacharacters that are still active within double-quoted strings.
1.4       frystyk    69: Xsed='sed -e 1s/^X//'
1.2       frystyk    70: sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
1.4       frystyk    71: SP2NL='tr \040 \012'
                     72: NL2SP='tr \012 \040'
1.2       frystyk    73: 
                     74: # NLS nuisances.
                     75: # Only set LANG and LC_ALL to C if already set.
                     76: # These must not be set unconditionally because not all systems understand
                     77: # e.g. LANG=C (notably SCO).
1.3       frystyk    78: # We save the old values to restore during execute mode.
                     79: if test "${LC_ALL+set}" = set; then
                     80:   save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
                     81: fi
                     82: if test "${LANG+set}" = set; then
                     83:   save_LANG="$LANG"; LANG=C; export LANG
                     84: fi
1.2       frystyk    85: 
1.1       frystyk    86: if test "$LTCONFIG_VERSION" != "$VERSION"; then
1.2       frystyk    87:   echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
1.1       frystyk    88:   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
                     89:   exit 1
                     90: fi
                     91: 
                     92: if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1.2       frystyk    93:   echo "$modename: not configured to build any kind of library" 1>&2
1.1       frystyk    94:   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
                     95:   exit 1
                     96: fi
                     97: 
                     98: # Global variables.
                     99: mode=$default_mode
                    100: nonopt=
                    101: prev=
                    102: prevopt=
                    103: run=
1.2       frystyk   104: show="$echo"
1.1       frystyk   105: show_help=
1.2       frystyk   106: execute_dlfiles=
1.4       frystyk   107: lo2o="s/\\.lo\$/.${objext}/"
1.5       frystyk   108: o2lo="s/\\.${objext}\$/.lo/"
1.1       frystyk   109: 
                    110: # Parse our command line options once, thoroughly.
                    111: while test $# -gt 0
                    112: do
                    113:   arg="$1"
                    114:   shift
                    115: 
                    116:   case "$arg" in
1.2       frystyk   117:   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
1.1       frystyk   118:   *) optarg= ;;
                    119:   esac
                    120: 
                    121:   # If the previous option needs an argument, assign it.
                    122:   if test -n "$prev"; then
1.2       frystyk   123:     case "$prev" in
                    124:     execute_dlfiles)
                    125:       eval "$prev=\"\$$prev \$arg\""
                    126:       ;;
                    127:     *)
                    128:       eval "$prev=\$arg"
                    129:       ;;
                    130:     esac
                    131: 
1.1       frystyk   132:     prev=
                    133:     prevopt=
                    134:     continue
                    135:   fi
                    136: 
                    137:   # Have we seen a non-optional argument yet?
                    138:   case "$arg" in
                    139:   --help)
                    140:     show_help=yes
                    141:     ;;
                    142: 
                    143:   --version)
1.4       frystyk   144:     echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
1.1       frystyk   145:     exit 0
                    146:     ;;
                    147: 
1.3       frystyk   148:   --config)
                    149:     sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
                    150:     exit 0
                    151:     ;;
                    152: 
                    153:   --debug)
                    154:     echo "$progname: enabling shell trace mode"
                    155:     set -x
                    156:     ;;
                    157: 
1.1       frystyk   158:   --dry-run | -n)
                    159:     run=:
                    160:     ;;
                    161: 
                    162:   --features)
                    163:     echo "host: $host"
                    164:     if test "$build_libtool_libs" = yes; then
                    165:       echo "enable shared libraries"
                    166:     else
                    167:       echo "disable shared libraries"
                    168:     fi
                    169:     if test "$build_old_libs" = yes; then
                    170:       echo "enable static libraries"
                    171:     else
                    172:       echo "disable static libraries"
                    173:     fi
                    174:     exit 0
                    175:     ;;
                    176: 
                    177:   --finish) mode="finish" ;;
                    178: 
                    179:   --mode) prevopt="--mode" prev=mode ;;
                    180:   --mode=*) mode="$optarg" ;;
                    181: 
1.2       frystyk   182:   --quiet | --silent)
                    183:     show=:
                    184:     ;;
                    185: 
                    186:   -dlopen)
                    187:     prevopt="-dlopen"
                    188:     prev=execute_dlfiles
                    189:     ;;
                    190: 
1.1       frystyk   191:   -*)
1.2       frystyk   192:     $echo "$modename: unrecognized option \`$arg'" 1>&2
                    193:     $echo "$help" 1>&2
1.1       frystyk   194:     exit 1
                    195:     ;;
                    196: 
                    197:   *)
                    198:     nonopt="$arg"
                    199:     break
                    200:     ;;
                    201:   esac
                    202: done
                    203: 
                    204: if test -n "$prevopt"; then
1.2       frystyk   205:   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
                    206:   $echo "$help" 1>&2
1.1       frystyk   207:   exit 1
                    208: fi
                    209: 
                    210: if test -z "$show_help"; then
                    211: 
                    212:   # Infer the operation mode.
                    213:   if test -z "$mode"; then
                    214:     case "$nonopt" in
1.2       frystyk   215:     *cc | *++ | gcc* | *-gcc*)
1.1       frystyk   216:       mode=link
                    217:       for arg
                    218:       do
1.4       frystyk   219:        case "$arg" in
                    220:        -c)
                    221:           mode=compile
                    222:           break
                    223:           ;;
                    224:        esac
1.1       frystyk   225:       done
                    226:       ;;
1.3       frystyk   227:     *db | *dbx | *strace | *truss)
1.2       frystyk   228:       mode=execute
                    229:       ;;
                    230:     *install*|cp|mv)
1.1       frystyk   231:       mode=install
                    232:       ;;
                    233:     *rm)
                    234:       mode=uninstall
                    235:       ;;
                    236:     *)
1.2       frystyk   237:       # If we have no mode, but dlfiles were specified, then do execute mode.
                    238:       test -n "$execute_dlfiles" && mode=execute
                    239: 
1.1       frystyk   240:       # Just use the default operation mode.
                    241:       if test -z "$mode"; then
1.4       frystyk   242:        if test -n "$nonopt"; then
                    243:          $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
                    244:        else
                    245:          $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
                    246:        fi
1.1       frystyk   247:       fi
                    248:       ;;
                    249:     esac
                    250:   fi
                    251: 
1.2       frystyk   252:   # Only execute mode is allowed to have -dlopen flags.
                    253:   if test -n "$execute_dlfiles" && test "$mode" != execute; then
                    254:     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
                    255:     $echo "$help" 1>&2
                    256:     exit 1
                    257:   fi
                    258: 
1.1       frystyk   259:   # Change the help message to a mode-specific one.
                    260:   generic_help="$help"
1.2       frystyk   261:   help="Try \`$modename --help --mode=$mode' for more information."
1.1       frystyk   262: 
                    263:   # These modes are in order of execution frequency so that they run quickly.
                    264:   case "$mode" in
                    265:   # libtool compile mode
                    266:   compile)
1.2       frystyk   267:     modename="$modename: compile"
1.1       frystyk   268:     # Get the compilation command and the source file.
1.2       frystyk   269:     base_compile=
1.1       frystyk   270:     lastarg=
1.2       frystyk   271:     srcfile="$nonopt"
                    272:     suppress_output=
1.1       frystyk   273: 
1.4       frystyk   274:     user_target=no
1.1       frystyk   275:     for arg
                    276:     do
1.2       frystyk   277:       # Accept any command-line options.
1.1       frystyk   278:       case "$arg" in
1.2       frystyk   279:       -o)
1.4       frystyk   280:        if test "$user_target" != "no"; then
                    281:          $echo "$modename: you cannot specify \`-o' more than once" 1>&2
                    282:          exit 1
                    283:        fi
                    284:        user_target=next
1.2       frystyk   285:        ;;
                    286: 
                    287:       -static)
                    288:        build_old_libs=yes
                    289:        continue
                    290:        ;;
                    291:       esac
                    292: 
1.4       frystyk   293:       case "$user_target" in
                    294:       next)
                    295:        # The next one is the -o target name
                    296:        user_target=yes
                    297:        continue
                    298:        ;;
                    299:       yes)
                    300:        # We got the output file
                    301:        user_target=set
                    302:        libobj="$arg"
                    303:        continue
                    304:        ;;
                    305:       esac
                    306: 
1.2       frystyk   307:       # Accept the current argument as the source file.
                    308:       lastarg="$srcfile"
                    309:       srcfile="$arg"
                    310: 
                    311:       # Aesthetically quote the previous argument.
                    312: 
                    313:       # Backslashify any backslashes, double quotes, and dollar signs.
                    314:       # These are the only characters that are still specially
                    315:       # interpreted inside of double-quoted scrings.
                    316:       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
                    317: 
                    318:       # Double-quote args containing other shell metacharacters.
                    319:       # Many Bourne shells cannot handle close brackets correctly in scan
                    320:       # sets, so we specify it separately.
                    321:       case "$lastarg" in
                    322:       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
                    323:        lastarg="\"$lastarg\""
                    324:        ;;
1.1       frystyk   325:       esac
                    326: 
1.2       frystyk   327:       # Add the previous argument to base_compile.
                    328:       if test -z "$base_compile"; then
                    329:        base_compile="$lastarg"
                    330:       else
                    331:        base_compile="$base_compile $lastarg"
                    332:       fi
1.1       frystyk   333:     done
                    334: 
1.4       frystyk   335:     case "$user_target" in
                    336:     set)
                    337:       ;;
                    338:     no)
                    339:       # Get the name of the library object.
                    340:       libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
                    341:       ;;
                    342:     *)
                    343:       $echo "$modename: you must specify a target with \`-o'" 1>&2
                    344:       exit 1
                    345:       ;;
                    346:     esac
1.1       frystyk   347: 
                    348:     # Recognize several different file suffixes.
1.4       frystyk   349:     # If the user specifies -o file.o, it is replaced with file.lo
                    350:     xform='[cCFSfmso]'
1.1       frystyk   351:     case "$libobj" in
1.2       frystyk   352:     *.ada) xform=ada ;;
                    353:     *.adb) xform=adb ;;
                    354:     *.ads) xform=ads ;;
                    355:     *.asm) xform=asm ;;
                    356:     *.c++) xform=c++ ;;
1.1       frystyk   357:     *.cc) xform=cc ;;
                    358:     *.cpp) xform=cpp ;;
                    359:     *.cxx) xform=cxx ;;
                    360:     *.f90) xform=f90 ;;
1.2       frystyk   361:     *.for) xform=for ;;
1.1       frystyk   362:     esac
                    363: 
1.2       frystyk   364:     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
1.1       frystyk   365: 
                    366:     case "$libobj" in
1.4       frystyk   367:     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
1.1       frystyk   368:     *)
1.4       frystyk   369:       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
1.1       frystyk   370:       exit 1
                    371:       ;;
                    372:     esac
                    373: 
                    374:     if test -z "$base_compile"; then
1.2       frystyk   375:       $echo "$modename: you must specify a compilation command" 1>&2
                    376:       $echo "$help" 1>&2
1.1       frystyk   377:       exit 1
                    378:     fi
                    379: 
                    380:     # Delete any leftover library objects.
                    381:     if test "$build_old_libs" = yes; then
1.4       frystyk   382:       removelist="$obj $libobj"
                    383:     else
                    384:       removelist="$libobj"
                    385:     fi
                    386: 
                    387:     $run $rm $removelist
                    388:     trap "$run $rm $removelist; exit 1" 1 2 15
                    389: 
                    390:     # Calculate the filename of the output object if compiler does
                    391:     # not support -o with -c
                    392:     if test "$compiler_c_o" = no; then
                    393:       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
                    394:       lockfile="$output_obj.lock"
                    395:       removelist="$removelist $output_obj $lockfile"
                    396:       trap "$run $rm $removelist; exit 1" 1 2 15
1.1       frystyk   397:     else
1.4       frystyk   398:       need_locks=no
                    399:       lockfile=
                    400:     fi
                    401: 
                    402:     # Lock this critical section if it is needed
                    403:     # We use this script file to make the link, it avoids creating a new file
                    404:     if test "$need_locks" = yes; then
                    405:       until ln "$0" "$lockfile" 2>/dev/null; do
                    406:        $show "Waiting for $lockfile to be removed"
                    407:        sleep 2
                    408:       done
                    409:     elif test "$need_locks" = warn; then
                    410:       if test -f "$lockfile"; then
                    411:        echo "\
                    412: *** ERROR, $lockfile exists and contains:
                    413: `cat $lockfile 2>/dev/null`
                    414: 
                    415: This indicates that another process is trying to use the same
                    416: temporary object file, and libtool could not work around it because
                    417: your compiler does not support \`-c' and \`-o' together.  If you
                    418: repeat this compilation, it may succeed, by chance, but you had better
                    419: avoid parallel builds (make -j) in this platform, or get a better
                    420: compiler."
                    421: 
                    422:        $run $rm $removelist
                    423:        exit 1
                    424:       fi
                    425:       echo $srcfile > "$lockfile"
                    426:     fi
                    427: 
                    428:     if test -n "$fix_srcfile_path"; then
                    429:       eval srcfile=\"$fix_srcfile_path\"
1.1       frystyk   430:     fi
                    431: 
                    432:     # Only build a PIC object if we are building libtool libraries.
                    433:     if test "$build_libtool_libs" = yes; then
1.2       frystyk   434:       # Without this assignment, base_compile gets emptied.
                    435:       fbsd_hideous_sh_bug=$base_compile
                    436: 
1.1       frystyk   437:       # All platforms use -DPIC, to notify preprocessed assembler code.
1.4       frystyk   438:       command="$base_compile $pic_flag -DPIC $srcfile"
                    439:       if test "$build_old_libs" = yes; then
1.5       frystyk   440:        lo_libobj="$libobj"
1.4       frystyk   441:        dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
                    442:        if test "X$dir" = "X$libobj"; then
                    443:          dir="$objdir"
                    444:        else
                    445:          dir="$dir/$objdir"
                    446:        fi
1.5       frystyk   447:        libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
1.4       frystyk   448: 
                    449:        if test -d "$dir"; then
                    450:          $show "$rm $libobj"
                    451:          $run $rm $libobj
                    452:        else
                    453:          $show "$mkdir $dir"
                    454:          $run $mkdir $dir
                    455:          status=$?
                    456:          if test $status -ne 0 && test ! -d $dir; then
                    457:            exit $status
                    458:          fi
                    459:        fi
                    460:       fi
                    461:       if test "$compiler_o_lo" = yes; then
                    462:        output_obj="$libobj"
                    463:        command="$command -o $output_obj"
                    464:       elif test "$compiler_c_o" = yes; then
                    465:        output_obj="$obj"
                    466:        command="$command -o $output_obj"
                    467:       fi
                    468: 
1.6     ! frystyk   469:       $run $rm "$output_obj"
1.4       frystyk   470:       $show "$command"
                    471:       if $run eval "$command"; then :
1.1       frystyk   472:       else
1.4       frystyk   473:        test -n "$output_obj" && $run $rm $removelist
                    474:        exit 1
                    475:       fi
                    476: 
                    477:       if test "$need_locks" = warn &&
                    478:         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
                    479:        echo "\
                    480: *** ERROR, $lockfile contains:
                    481: `cat $lockfile 2>/dev/null`
                    482: 
                    483: but it should contain:
                    484: $srcfile
                    485: 
                    486: This indicates that another process is trying to use the same
                    487: temporary object file, and libtool could not work around it because
                    488: your compiler does not support \`-c' and \`-o' together.  If you
                    489: repeat this compilation, it may succeed, by chance, but you had better
                    490: avoid parallel builds (make -j) in this platform, or get a better
                    491: compiler."
                    492: 
                    493:        $run $rm $removelist
                    494:        exit 1
                    495:       fi
                    496: 
                    497:       # Just move the object if needed, then go on to compile the next one
                    498:       if test x"$output_obj" != x"$libobj"; then
                    499:        $show "$mv $output_obj $libobj"
                    500:        if $run $mv $output_obj $libobj; then :
                    501:        else
                    502:          error=$?
                    503:          $run $rm $removelist
                    504:          exit $error
                    505:        fi
1.1       frystyk   506:       fi
                    507: 
                    508:       # If we have no pic_flag, then copy the object into place and finish.
1.4       frystyk   509:       if test -z "$pic_flag" && test "$build_old_libs" = yes; then
                    510:        # Rename the .lo from within objdir to obj
1.5       frystyk   511:        if test -f $obj; then
1.4       frystyk   512:          $show $rm $obj
                    513:          $run $rm $obj
                    514:        fi
                    515: 
                    516:        $show "$mv $libobj $obj"
                    517:        if $run $mv $libobj $obj; then :
                    518:        else
                    519:          error=$?
                    520:          $run $rm $removelist
                    521:          exit $error
                    522:        fi
                    523: 
                    524:        # Now arrange that obj and lo_libobj become the same file
                    525:        $show "$LN_S $obj $lo_libobj"
                    526:        if $run $LN_S $obj $lo_libobj; then
                    527:          exit 0
                    528:        else
                    529:          error=$?
                    530:          $run $rm $removelist
                    531:          exit $error
                    532:        fi
1.1       frystyk   533:       fi
                    534: 
1.2       frystyk   535:       # Allow error messages only from the first compilation.
                    536:       suppress_output=' >/dev/null 2>&1'
1.1       frystyk   537:     fi
                    538: 
                    539:     # Only build a position-dependent object if we build old libraries.
                    540:     if test "$build_old_libs" = yes; then
1.4       frystyk   541:       command="$base_compile $srcfile"
                    542:       if test "$compiler_c_o" = yes; then
                    543:        command="$command -o $obj"
                    544:        output_obj="$obj"
                    545:       fi
                    546: 
1.2       frystyk   547:       # Suppress compiler output if we already did a PIC compilation.
1.4       frystyk   548:       command="$command$suppress_output"
1.6     ! frystyk   549:       $run $rm "$output_obj"
1.4       frystyk   550:       $show "$command"
                    551:       if $run eval "$command"; then :
1.1       frystyk   552:       else
1.4       frystyk   553:        $run $rm $removelist
                    554:        exit 1
                    555:       fi
                    556: 
                    557:       if test "$need_locks" = warn &&
                    558:         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
                    559:        echo "\
                    560: *** ERROR, $lockfile contains:
                    561: `cat $lockfile 2>/dev/null`
                    562: 
                    563: but it should contain:
                    564: $srcfile
                    565: 
                    566: This indicates that another process is trying to use the same
                    567: temporary object file, and libtool could not work around it because
                    568: your compiler does not support \`-c' and \`-o' together.  If you
                    569: repeat this compilation, it may succeed, by chance, but you had better
                    570: avoid parallel builds (make -j) in this platform, or get a better
                    571: compiler."
                    572: 
                    573:        $run $rm $removelist
                    574:        exit 1
                    575:       fi
                    576: 
                    577:       # Just move the object if needed
                    578:       if test x"$output_obj" != x"$obj"; then
                    579:        $show "$mv $output_obj $obj"
                    580:        if $run $mv $output_obj $obj; then :
                    581:        else
                    582:          error=$?
                    583:          $run $rm $removelist
                    584:          exit $error
                    585:        fi
                    586:       fi
                    587: 
                    588:       # Create an invalid libtool object if no PIC, so that we do not
                    589:       # accidentally link it into a program.
                    590:       if test "$build_libtool_libs" != yes; then
1.5       frystyk   591:        $show "echo timestamp > $libobj"
                    592:        $run eval "echo timestamp > \$libobj" || exit $?
1.4       frystyk   593:       else
                    594:        # Move the .lo from within objdir
                    595:        $show "$mv $libobj $lo_libobj"
                    596:        if $run $mv $libobj $lo_libobj; then :
                    597:        else
                    598:          error=$?
                    599:          $run $rm $removelist
                    600:          exit $error
                    601:        fi
1.1       frystyk   602:       fi
                    603:     fi
                    604: 
1.4       frystyk   605:     # Unlock the critical section if it was locked
                    606:     if test "$need_locks" != no; then
                    607:       $rm "$lockfile"
1.1       frystyk   608:     fi
                    609: 
                    610:     exit 0
                    611:     ;;
                    612: 
                    613:   # libtool link mode
                    614:   link)
1.2       frystyk   615:     modename="$modename: link"
1.4       frystyk   616:     C_compiler="$CC" # save it, to compile generated C sources
1.2       frystyk   617:     CC="$nonopt"
1.4       frystyk   618:     case "$host" in
1.5       frystyk   619:     *-*-cygwin* | *-*-mingw* | *-*-os2*)
1.4       frystyk   620:       # It is impossible to link a dll without this setting, and
                    621:       # we shouldn't force the makefile maintainer to figure out
                    622:       # which system we are compiling for in order to pass an extra
                    623:       # flag for every libtool invokation.
                    624:       # allow_undefined=no
                    625: 
                    626:       # FIXME: Unfortunately, there are problems with the above when trying
                    627:       # to make a dll which has undefined symbols, in which case not
                    628:       # even a static library is built.  For now, we need to specify
                    629:       # -no-undefined on the libtool link line when we can be certain
                    630:       # that all symbols are satisfied, otherwise we get a static library.
                    631:       allow_undefined=yes
                    632: 
                    633:       # This is a source program that is used to create dlls on Windows
                    634:       # Don't remove nor modify the starting and closing comments
                    635: # /* ltdll.c starts here */
                    636: # #define WIN32_LEAN_AND_MEAN
                    637: # #include <windows.h>
                    638: # #undef WIN32_LEAN_AND_MEAN
                    639: # #include <stdio.h>
                    640: #
1.5       frystyk   641: # #ifdef __cplusplus
                    642: # extern "C" {
                    643: # #endif
1.4       frystyk   644: # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
1.5       frystyk   645: # #ifdef __cplusplus
                    646: # }
                    647: # #endif
1.4       frystyk   648: #
                    649: # #include <cygwin/cygwin_dll.h>
                    650: # DECLARE_CYGWIN_DLL( DllMain );
                    651: # HINSTANCE __hDllInstance_base;
                    652: #
                    653: # BOOL APIENTRY
                    654: # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
                    655: # {
                    656: #   __hDllInstance_base = hInst;
                    657: #   return TRUE;
                    658: # }
                    659: # /* ltdll.c ends here */
1.5       frystyk   660:       # This is a source program that is used to create import libraries
                    661:       # on Windows for dlls which lack them. Don't remove nor modify the
                    662:       # starting and closing comments
                    663: # /* impgen.c starts here */
                    664: # /*   Copyright (C) 1999 Free Software Foundation, Inc.
                    665: # 
                    666: #  This file is part of GNU libtool.
                    667: # 
                    668: #  This program is free software; you can redistribute it and/or modify
                    669: #  it under the terms of the GNU General Public License as published by
                    670: #  the Free Software Foundation; either version 2 of the License, or
                    671: #  (at your option) any later version.
                    672: # 
                    673: #  This program is distributed in the hope that it will be useful,
                    674: #  but WITHOUT ANY WARRANTY; without even the implied warranty of
                    675: #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                    676: #  GNU General Public License for more details.
                    677: # 
                    678: #  You should have received a copy of the GNU General Public License
                    679: #  along with this program; if not, write to the Free Software
                    680: #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
                    681: #  */
                    682: # 
                    683: #  #include <stdio.h>          /* for printf() */
                    684: #  #include <unistd.h>         /* for open(), lseek(), read() */
                    685: #  #include <fcntl.h>          /* for O_RDONLY, O_BINARY */
                    686: #  #include <string.h>         /* for strdup() */
                    687: # 
                    688: #  static unsigned int
                    689: #  pe_get16 (fd, offset)
                    690: #       int fd;
                    691: #       int offset;
                    692: #  {
                    693: #    unsigned char b[2];
                    694: #    lseek (fd, offset, SEEK_SET);
                    695: #    read (fd, b, 2);
                    696: #    return b[0] + (b[1]<<8);
                    697: #  }
                    698: # 
                    699: #  static unsigned int
                    700: #  pe_get32 (fd, offset)
                    701: #      int fd;
                    702: #      int offset;
                    703: #  {
                    704: #    unsigned char b[4];
                    705: #    lseek (fd, offset, SEEK_SET);
                    706: #    read (fd, b, 4);
                    707: #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
                    708: #  }
                    709: # 
                    710: #  static unsigned int
                    711: #  pe_as32 (ptr)
                    712: #       void *ptr;
                    713: #  {
                    714: #    unsigned char *b = ptr;
                    715: #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
                    716: #  }
                    717: # 
                    718: #  int
                    719: #  main (argc, argv)
                    720: #      int argc;
                    721: #      char *argv[];
                    722: #  {
                    723: #      int dll;
                    724: #      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
                    725: #      unsigned long export_rva, export_size, nsections, secptr, expptr;
                    726: #      unsigned long name_rvas, nexp;
                    727: #      unsigned char *expdata, *erva;
                    728: #      char *filename, *dll_name;
                    729: # 
                    730: #      filename = argv[1];
                    731: # 
                    732: #      dll = open(filename, O_RDONLY|O_BINARY);
                    733: #      if (!dll)
                    734: #      return 1;
                    735: # 
                    736: #      dll_name = filename;
                    737: #    
                    738: #      for (i=0; filename[i]; i++)
                    739: #      if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
                    740: #          dll_name = filename + i +1;
                    741: # 
                    742: #      pe_header_offset = pe_get32 (dll, 0x3c);
                    743: #      opthdr_ofs = pe_header_offset + 4 + 20;
                    744: #      num_entries = pe_get32 (dll, opthdr_ofs + 92);
                    745: # 
                    746: #      if (num_entries < 1) /* no exports */
                    747: #      return 1;
                    748: # 
                    749: #      export_rva = pe_get32 (dll, opthdr_ofs + 96);
                    750: #      export_size = pe_get32 (dll, opthdr_ofs + 100);
                    751: #      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
                    752: #      secptr = (pe_header_offset + 4 + 20 +
                    753: #            pe_get16 (dll, pe_header_offset + 4 + 16));
                    754: # 
                    755: #      expptr = 0;
                    756: #      for (i = 0; i < nsections; i++)
                    757: #      {
                    758: #      char sname[8];
                    759: #      unsigned long secptr1 = secptr + 40 * i;
                    760: #      unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
                    761: #      unsigned long vsize = pe_get32 (dll, secptr1 + 16);
                    762: #      unsigned long fptr = pe_get32 (dll, secptr1 + 20);
                    763: #      lseek(dll, secptr1, SEEK_SET);
                    764: #      read(dll, sname, 8);
                    765: #      if (vaddr <= export_rva && vaddr+vsize > export_rva)
                    766: #      {
                    767: #          expptr = fptr + (export_rva - vaddr);
                    768: #          if (export_rva + export_size > vaddr + vsize)
                    769: #              export_size = vsize - (export_rva - vaddr);
                    770: #          break;
                    771: #      }
                    772: #      }
                    773: # 
                    774: #      expdata = (unsigned char*)malloc(export_size);
                    775: #      lseek (dll, expptr, SEEK_SET);
                    776: #      read (dll, expdata, export_size);
                    777: #      erva = expdata - export_rva;
                    778: # 
                    779: #      nexp = pe_as32 (expdata+24);
                    780: #      name_rvas = pe_as32 (expdata+32);
                    781: # 
                    782: #      printf ("EXPORTS\n");
                    783: #      for (i = 0; i<nexp; i++)
                    784: #      {
                    785: #      unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
                    786: #      printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
                    787: #      }
                    788: # 
                    789: #      return 0;
                    790: #  }
                    791: # /* impgen.c ends here */
1.4       frystyk   792:       ;;
                    793:     *)
                    794:       allow_undefined=yes
                    795:       ;;
                    796:     esac
1.2       frystyk   797:     compile_command="$CC"
                    798:     finalize_command="$CC"
                    799: 
1.5       frystyk   800:     compile_rpath=
                    801:     finalize_rpath=
1.1       frystyk   802:     compile_shlibpath=
                    803:     finalize_shlibpath=
1.3       frystyk   804:     convenience=
                    805:     old_convenience=
1.1       frystyk   806:     deplibs=
1.5       frystyk   807:     linkopts=
1.4       frystyk   808: 
                    809:     if test -n "$shlibpath_var"; then
                    810:       # get the directories listed in $shlibpath_var
                    811:       eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
                    812:     else
1.5       frystyk   813:       lib_search_path=
1.4       frystyk   814:     fi
                    815:     # now prepend the system-specific ones
                    816:     eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
1.5       frystyk   817:     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1.4       frystyk   818:     
                    819:     avoid_version=no
1.2       frystyk   820:     dlfiles=
                    821:     dlprefiles=
1.5       frystyk   822:     dlself=no
1.1       frystyk   823:     export_dynamic=no
1.4       frystyk   824:     export_symbols=
1.5       frystyk   825:     export_symbols_regex=
1.3       frystyk   826:     generated=
1.1       frystyk   827:     libobjs=
                    828:     link_against_libtool_libs=
                    829:     ltlibs=
1.4       frystyk   830:     module=no
1.1       frystyk   831:     objs=
1.5       frystyk   832:     prefer_static_libs=no
1.4       frystyk   833:     preload=no
1.1       frystyk   834:     prev=
                    835:     prevarg=
1.2       frystyk   836:     release=
                    837:     rpath=
1.4       frystyk   838:     xrpath=
1.1       frystyk   839:     perm_rpath=
                    840:     temp_rpath=
1.5       frystyk   841:     thread_safe=no
1.1       frystyk   842:     vinfo=
                    843: 
                    844:     # We need to know -static, to get the right output filenames.
                    845:     for arg
                    846:     do
                    847:       case "$arg" in
1.2       frystyk   848:       -all-static | -static)
1.5       frystyk   849:        if test "X$arg" = "X-all-static"; then
                    850:          if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1.2       frystyk   851:            $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1.5       frystyk   852:          fi
                    853:          if test -n "$link_static_flag"; then
                    854:            dlopen_self=$dlopen_self_static
                    855:          fi
                    856:        else
                    857:          if test -z "$pic_flag" && test -n "$link_static_flag"; then
                    858:            dlopen_self=$dlopen_self_static
                    859:          fi
1.4       frystyk   860:        fi
                    861:        build_libtool_libs=no
1.2       frystyk   862:        build_old_libs=yes
1.5       frystyk   863:        prefer_static_libs=yes
1.4       frystyk   864:        break
                    865:        ;;
1.1       frystyk   866:       esac
                    867:     done
                    868: 
1.2       frystyk   869:     # See if our shared archives depend on static archives.
                    870:     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
                    871: 
                    872:     # Go through the arguments, transforming them on the way.
1.3       frystyk   873:     while test $# -gt 0; do
                    874:       arg="$1"
                    875:       shift
                    876: 
1.1       frystyk   877:       # If the previous option needs an argument, assign it.
                    878:       if test -n "$prev"; then
1.4       frystyk   879:        case "$prev" in
                    880:        output)
                    881:          compile_command="$compile_command @OUTPUT@"
                    882:          finalize_command="$finalize_command @OUTPUT@"
                    883:          ;;
                    884:        esac
                    885: 
                    886:        case "$prev" in
                    887:        dlfiles|dlprefiles)
                    888:          if test "$preload" = no; then
                    889:            # Add the symbol object into the linking commands.
                    890:            compile_command="$compile_command @SYMFILE@"
                    891:            finalize_command="$finalize_command @SYMFILE@"
                    892:            preload=yes
                    893:          fi
                    894:          case "$arg" in
                    895:          *.la | *.lo) ;;  # We handle these cases below.
1.5       frystyk   896:          self)
                    897:            if test "$prev" = dlprefiles; then
                    898:              dlself=yes
                    899:            elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
                    900:              dlself=yes
                    901:            else
                    902:              dlself=needless
                    903:              export_dynamic=yes
                    904:            fi
                    905:            prev=
                    906:            continue
                    907:            ;;
1.4       frystyk   908:          *)
1.5       frystyk   909:            if test "$prev" = dlfiles; then
                    910:              dlfiles="$dlfiles $arg"
                    911:            else
                    912:              dlprefiles="$dlprefiles $arg"
                    913:            fi
1.4       frystyk   914:            prev=
                    915:            ;;
                    916:          esac
                    917:          ;;
1.5       frystyk   918:        expsyms)
1.4       frystyk   919:          export_symbols="$arg"
                    920:          if test ! -f "$arg"; then
                    921:            $echo "$modename: symbol file \`$arg' does not exist"
                    922:            exit 1
                    923:          fi
                    924:          prev=
1.5       frystyk   925:          continue
1.4       frystyk   926:          ;;
1.5       frystyk   927:        expsyms_regex)
                    928:          export_symbols_regex="$arg"
1.2       frystyk   929:          prev=
                    930:          continue
                    931:          ;;
1.5       frystyk   932:        release)
                    933:          release="-$arg"
1.4       frystyk   934:          prev=
                    935:          continue
                    936:          ;;
1.5       frystyk   937:        rpath | xrpath)
                    938:          # We need an absolute path.
                    939:          case "$arg" in
                    940:          [\\/]* | [A-Za-z]:[\\/]*) ;;
                    941:          *)
                    942:            $echo "$modename: only absolute run-paths are allowed" 1>&2
                    943:            exit 1
                    944:            ;;
                    945:          esac
                    946:          if test "$prev" = rpath; then
                    947:            case "$rpath " in
                    948:            *" $arg "*) ;;
                    949:            *) rpath="$rpath $arg" ;;
                    950:            esac
                    951:          else
                    952:            case "$xrpath " in
                    953:            *" $arg "*) ;;
                    954:            *) xrpath="$xrpath $arg" ;;
                    955:            esac
                    956:          fi
1.4       frystyk   957:          prev=
                    958:          continue
                    959:          ;;
                    960:        *)
                    961:          eval "$prev=\"\$arg\""
1.2       frystyk   962:          prev=
                    963:          continue
1.1       frystyk   964:          ;;
1.4       frystyk   965:        esac
1.1       frystyk   966:       fi
                    967: 
                    968:       prevarg="$arg"
                    969: 
                    970:       case "$arg" in
1.2       frystyk   971:       -all-static)
                    972:        if test -n "$link_static_flag"; then
1.4       frystyk   973:          compile_command="$compile_command $link_static_flag"
1.2       frystyk   974:          finalize_command="$finalize_command $link_static_flag"
1.4       frystyk   975:        fi
                    976:        continue
1.2       frystyk   977:        ;;
1.1       frystyk   978: 
1.2       frystyk   979:       -allow-undefined)
                    980:        # FIXME: remove this flag sometime in the future.
                    981:        $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1.1       frystyk   982:        continue
                    983:        ;;
                    984: 
1.4       frystyk   985:       -avoid-version)
                    986:        avoid_version=yes
                    987:        continue
                    988:        ;;
                    989: 
1.2       frystyk   990:       -dlopen)
1.4       frystyk   991:        prev=dlfiles
                    992:        continue
                    993:        ;;
1.2       frystyk   994: 
                    995:       -dlpreopen)
1.4       frystyk   996:        prev=dlprefiles
                    997:        continue
                    998:        ;;
1.2       frystyk   999: 
                   1000:       -export-dynamic)
1.5       frystyk  1001:        export_dynamic=yes
                   1002:        continue
1.4       frystyk  1003:        ;;
1.2       frystyk  1004: 
1.5       frystyk  1005:       -export-symbols | -export-symbols-regex)
                   1006:        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
                   1007:          $echo "$modename: not more than one -exported-symbols argument allowed"
1.4       frystyk  1008:          exit 1
                   1009:        fi
1.5       frystyk  1010:        if test "X$arg" = "X-export-symbols"; then
                   1011:          prev=expsyms
                   1012:        else
                   1013:          prev=expsyms_regex
                   1014:        fi
1.4       frystyk  1015:        continue
                   1016:        ;;
1.2       frystyk  1017: 
1.1       frystyk  1018:       -L*)
1.5       frystyk  1019:        dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
                   1020:        # We need an absolute path.
1.4       frystyk  1021:        case "$dir" in
1.5       frystyk  1022:        [\\/]* | [A-Za-z]:[\\/]*) ;;
1.4       frystyk  1023:        *)
1.5       frystyk  1024:          absdir=`cd "$dir" && pwd`
                   1025:          if test -z "$absdir"; then
1.6     ! frystyk  1026:            $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
        !          1027:            $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
        !          1028:            absdir="$dir"
1.5       frystyk  1029:          fi
                   1030:          dir="$absdir"
1.4       frystyk  1031:          ;;
                   1032:        esac
1.5       frystyk  1033:        case " $deplibs " in
                   1034:        *" $arg "*) ;;
                   1035:        *) deplibs="$deplibs $arg";;
                   1036:        esac
                   1037:        case " $lib_search_path " in
                   1038:        *" $dir "*) ;;
                   1039:        *) lib_search_path="$lib_search_path $dir";;
                   1040:        esac
1.4       frystyk  1041:        case "$host" in
1.5       frystyk  1042:        *-*-cygwin* | *-*-mingw* | *-*-os2*)
                   1043:          dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
                   1044:          case ":$dllsearchpath:" in
                   1045:          ::) dllsearchpath="$dllsearchdir";;
                   1046:          *":$dllsearchdir:"*) ;;
                   1047:          *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
                   1048:          esac
1.4       frystyk  1049:          ;;
                   1050:        esac
                   1051:        ;;
1.1       frystyk  1052: 
1.4       frystyk  1053:       -l*)
1.5       frystyk  1054:        if test "$arg" = "-lc"; then
                   1055:          case "$host" in
                   1056:          *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
                   1057:            # These systems don't actually have c library (as such)
                   1058:            continue
                   1059:            ;;
                   1060:          esac
                   1061:        elif test "$arg" = "-lm"; then
                   1062:          case "$host" in
                   1063:          *-*-cygwin* | *-*-beos*)
                   1064:            # These systems don't actually have math library (as such)
                   1065:            continue
                   1066:            ;;
                   1067:          esac
                   1068:        fi
1.4       frystyk  1069:        deplibs="$deplibs $arg"
                   1070:        ;;
1.1       frystyk  1071: 
1.4       frystyk  1072:       -module)
1.5       frystyk  1073:        module=yes
                   1074:        continue
1.4       frystyk  1075:        ;;
1.5       frystyk  1076: 
1.2       frystyk  1077:       -no-undefined)
                   1078:        allow_undefined=no
                   1079:        continue
                   1080:        ;;
                   1081: 
1.1       frystyk  1082:       -o) prev=output ;;
                   1083: 
1.2       frystyk  1084:       -release)
                   1085:        prev=release
1.1       frystyk  1086:        continue
                   1087:        ;;
                   1088: 
1.2       frystyk  1089:       -rpath)
1.4       frystyk  1090:        prev=rpath
                   1091:        continue
                   1092:        ;;
                   1093: 
                   1094:       -R)
                   1095:        prev=xrpath
                   1096:        continue
                   1097:        ;;
                   1098: 
                   1099:       -R*)
1.5       frystyk  1100:        dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
                   1101:        # We need an absolute path.
                   1102:        case "$dir" in
                   1103:        [\\/]* | [A-Za-z]:[\\/]*) ;;
                   1104:        *)
                   1105:          $echo "$modename: only absolute run-paths are allowed" 1>&2
                   1106:          exit 1
                   1107:          ;;
                   1108:        esac
                   1109:        case "$xrpath " in
                   1110:        *" $dir "*) ;;
                   1111:        *) xrpath="$xrpath $dir" ;;
                   1112:        esac
1.4       frystyk  1113:        continue
                   1114:        ;;
1.2       frystyk  1115: 
1.1       frystyk  1116:       -static)
1.2       frystyk  1117:        # If we have no pic_flag, then this is the same as -all-static.
                   1118:        if test -z "$pic_flag" && test -n "$link_static_flag"; then
1.4       frystyk  1119:          compile_command="$compile_command $link_static_flag"
1.2       frystyk  1120:          finalize_command="$finalize_command $link_static_flag"
1.4       frystyk  1121:        fi
1.1       frystyk  1122:        continue
                   1123:        ;;
                   1124: 
1.5       frystyk  1125:       -thread-safe)
                   1126:        thread_safe=yes
                   1127:        continue
                   1128:        ;;
                   1129: 
1.1       frystyk  1130:       -version-info)
1.4       frystyk  1131:        prev=vinfo
                   1132:        continue
                   1133:        ;;
1.1       frystyk  1134: 
1.2       frystyk  1135:       # Some other compiler flag.
                   1136:       -* | +*)
                   1137:        # Unknown arguments in both finalize_command and compile_command need
                   1138:        # to be aesthetically quoted because they are evaled later.
                   1139:        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
                   1140:        case "$arg" in
                   1141:        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)
                   1142:          arg="\"$arg\""
                   1143:          ;;
                   1144:        esac
1.4       frystyk  1145:        ;;
1.1       frystyk  1146: 
1.4       frystyk  1147:       *.o | *.obj | *.a | *.lib)
                   1148:        # A standard object.
                   1149:        objs="$objs $arg"
                   1150:        ;;
1.1       frystyk  1151: 
                   1152:       *.lo)
1.4       frystyk  1153:        # A library object.
1.2       frystyk  1154:        if test "$prev" = dlfiles; then
                   1155:          dlfiles="$dlfiles $arg"
1.5       frystyk  1156:          if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
1.2       frystyk  1157:            prev=
                   1158:            continue
                   1159:          else
                   1160:            # If libtool objects are unsupported, then we need to preload.
                   1161:            prev=dlprefiles
                   1162:          fi
1.1       frystyk  1163:        fi
                   1164: 
1.2       frystyk  1165:        if test "$prev" = dlprefiles; then
                   1166:          # Preload the old-style object.
1.4       frystyk  1167:          dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1.2       frystyk  1168:          prev=
1.1       frystyk  1169:        fi
1.2       frystyk  1170:        libobjs="$libobjs $arg"
1.4       frystyk  1171:        ;;
1.1       frystyk  1172: 
1.2       frystyk  1173:       *.la)
1.4       frystyk  1174:        # A libtool-controlled library.
1.1       frystyk  1175: 
1.4       frystyk  1176:        dlname=
                   1177:        libdir=
                   1178:        library_names=
                   1179:        old_library=
1.1       frystyk  1180: 
1.4       frystyk  1181:        # Check to see that this really is a libtool archive.
                   1182:        if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
                   1183:        else
                   1184:          $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
                   1185:          exit 1
                   1186:        fi
                   1187: 
                   1188:        # If the library was installed with an old release of libtool,
                   1189:        # it will not redefine variable installed.
                   1190:        installed=yes
                   1191: 
1.5       frystyk  1192:        # Read the .la file
1.4       frystyk  1193:        # If there is no directory component, then add one.
                   1194:        case "$arg" in
                   1195:        */* | *\\*) . $arg ;;
                   1196:        *) . ./$arg ;;
                   1197:        esac
                   1198: 
                   1199:        # Get the name of the library we link against.
                   1200:        linklib=
                   1201:        for l in $old_library $library_names; do
                   1202:          linklib="$l"
                   1203:        done
                   1204: 
                   1205:        if test -z "$linklib"; then
                   1206:          $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
                   1207:          exit 1
                   1208:        fi
                   1209: 
                   1210:        # Find the relevant object directory and library name.
                   1211:        name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
                   1212: 
                   1213:        if test "X$installed" = Xyes; then
                   1214:          dir="$libdir"
                   1215:        else
                   1216:          dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
                   1217:          if test "X$dir" = "X$arg"; then
                   1218:            dir="$objdir"
                   1219:          else
                   1220:            dir="$dir/$objdir"
                   1221:          fi
                   1222:        fi
                   1223: 
                   1224:        if test -n "$dependency_libs"; then
                   1225:          # Extract -R from dependency_libs
                   1226:          temp_deplibs=
                   1227:          for deplib in $dependency_libs; do
                   1228:            case "$deplib" in
1.5       frystyk  1229:            -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
                   1230:                 case " $rpath $xrpath " in
                   1231:                 *" $temp_xrpath "*) ;;
                   1232:                 *) xrpath="$xrpath $temp_xrpath";;
                   1233:                 esac;;
                   1234:            -L*) case "$compile_command $temp_deplibs " in
                   1235:                 *" $deplib "*) ;;
                   1236:                 *) temp_deplibs="$temp_deplibs $deplib";;
                   1237:                 esac;;
1.4       frystyk  1238:            *) temp_deplibs="$temp_deplibs $deplib";;
                   1239:            esac
                   1240:          done
                   1241:          dependency_libs="$temp_deplibs"
                   1242:        fi
                   1243: 
                   1244:        if test -z "$libdir"; then
1.3       frystyk  1245:          # It is a libtool convenience library, so add in its objects.
1.4       frystyk  1246:          convenience="$convenience $dir/$old_library"
1.3       frystyk  1247:          old_convenience="$old_convenience $dir/$old_library"
1.4       frystyk  1248:          deplibs="$deplibs$dependency_libs"
                   1249:          compile_command="$compile_command $dir/$old_library$dependency_libs"
                   1250:          finalize_command="$finalize_command $dir/$old_library$dependency_libs"
1.3       frystyk  1251:          continue
                   1252:        fi
                   1253: 
1.4       frystyk  1254:        # This library was specified with -dlopen.
                   1255:        if test "$prev" = dlfiles; then
                   1256:          dlfiles="$dlfiles $arg"
1.5       frystyk  1257:          if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
                   1258:            # If there is no dlname, no dlopen support or we're linking statically,
1.4       frystyk  1259:            # we need to preload.
                   1260:            prev=dlprefiles
                   1261:          else
                   1262:            # We should not create a dependency on this library, but we
1.2       frystyk  1263:            # may need any libraries it requires.
                   1264:            compile_command="$compile_command$dependency_libs"
                   1265:            finalize_command="$finalize_command$dependency_libs"
1.4       frystyk  1266:            prev=
                   1267:            continue
                   1268:          fi
                   1269:        fi
                   1270: 
                   1271:        # The library was specified with -dlpreopen.
                   1272:        if test "$prev" = dlprefiles; then
                   1273:          # Prefer using a static library (so that no silly _DYNAMIC symbols
                   1274:          # are required to link).
                   1275:          if test -n "$old_library"; then
                   1276:            dlprefiles="$dlprefiles $dir/$old_library"
                   1277:          else
                   1278:            dlprefiles="$dlprefiles $dir/$linklib"
                   1279:          fi
                   1280:          prev=
                   1281:        fi
                   1282: 
1.5       frystyk  1283:        if test -n "$library_names" &&
                   1284:           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1.4       frystyk  1285:          link_against_libtool_libs="$link_against_libtool_libs $arg"
                   1286:          if test -n "$shlibpath_var"; then
                   1287:            # Make sure the rpath contains only unique directories.
                   1288:            case "$temp_rpath " in
                   1289:            *" $dir "*) ;;
                   1290:            *) temp_rpath="$temp_rpath $dir" ;;
                   1291:            esac
                   1292:          fi
1.2       frystyk  1293: 
1.5       frystyk  1294:          # We need an absolute path.
                   1295:          case "$dir" in
                   1296:          [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
                   1297:          *)
                   1298:            absdir=`cd "$dir" && pwd`
                   1299:            if test -z "$absdir"; then
1.6     ! frystyk  1300:              $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
        !          1301:              $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
        !          1302:              absdir="$dir"
1.5       frystyk  1303:            fi
                   1304:            ;;
                   1305:          esac
                   1306:          
1.2       frystyk  1307:          # This is the magic to use -rpath.
1.5       frystyk  1308:          # Skip directories that are in the system default run-time
                   1309:          # search path, unless they have been requested with -R.
                   1310:          case " $sys_lib_dlsearch_path " in
                   1311:          *" $absdir "*) ;;
                   1312:          *)
                   1313:            case "$compile_rpath " in
                   1314:            *" $absdir "*) ;;
                   1315:            *) compile_rpath="$compile_rpath $absdir" 
1.4       frystyk  1316:            esac
1.5       frystyk  1317:            ;;
                   1318:          esac
1.4       frystyk  1319: 
1.5       frystyk  1320:          case " $sys_lib_dlsearch_path " in
                   1321:          *" $libdir "*) ;;
                   1322:          *)
                   1323:            case "$finalize_rpath " in
1.4       frystyk  1324:            *" $libdir "*) ;;
1.5       frystyk  1325:            *) finalize_rpath="$finalize_rpath $libdir"
1.4       frystyk  1326:            esac
1.5       frystyk  1327:            ;;
                   1328:          esac
1.2       frystyk  1329: 
1.3       frystyk  1330:          lib_linked=yes
1.4       frystyk  1331:          case "$hardcode_action" in
                   1332:          immediate | unsupported)
                   1333:            if test "$hardcode_direct" = no; then
                   1334:              compile_command="$compile_command $dir/$linklib"
                   1335:              deplibs="$deplibs $dir/$linklib"
                   1336:              case "$host" in
1.5       frystyk  1337:              *-*-cygwin* | *-*-mingw* | *-*-os2*)
1.4       frystyk  1338:                dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
                   1339:                if test -n "$dllsearchpath"; then
                   1340:                  dllsearchpath="$dllsearchpath:$dllsearchdir"
                   1341:                else
                   1342:                  dllsearchpath="$dllsearchdir"
                   1343:                fi
                   1344:                ;;
                   1345:              esac
                   1346:            elif test "$hardcode_minus_L" = no; then
                   1347:              case "$host" in
                   1348:              *-*-sunos*)
                   1349:                compile_shlibpath="$compile_shlibpath$dir:"
                   1350:                ;;
                   1351:              esac
1.5       frystyk  1352:              case "$compile_command " in
                   1353:              *" -L$dir "*) ;;
                   1354:              *) compile_command="$compile_command -L$dir";;
                   1355:              esac
                   1356:              compile_command="$compile_command -l$name"
1.4       frystyk  1357:              deplibs="$deplibs -L$dir -l$name"
                   1358:            elif test "$hardcode_shlibpath_var" = no; then
1.5       frystyk  1359:              case ":$compile_shlibpath:" in
                   1360:              *":$dir:"*) ;;
                   1361:              *) compile_shlibpath="$compile_shlibpath$dir:";;
                   1362:              esac
1.4       frystyk  1363:              compile_command="$compile_command -l$name"
                   1364:              deplibs="$deplibs -l$name"
1.3       frystyk  1365:            else
                   1366:              lib_linked=no
1.4       frystyk  1367:            fi
                   1368:            ;;
1.2       frystyk  1369: 
1.4       frystyk  1370:          relink)
                   1371:            if test "$hardcode_direct" = yes; then
1.5       frystyk  1372:              compile_command="$compile_command $absdir/$linklib"
                   1373:              deplibs="$deplibs $absdir/$linklib"
1.4       frystyk  1374:            elif test "$hardcode_minus_L" = yes; then
1.5       frystyk  1375:              case "$compile_command " in
                   1376:              *" -L$absdir "*) ;;
                   1377:              *) compile_command="$compile_command -L$absdir";;
                   1378:              esac
                   1379:              compile_command="$compile_command -l$name"
                   1380:              deplibs="$deplibs -L$absdir -l$name"
1.4       frystyk  1381:            elif test "$hardcode_shlibpath_var" = yes; then
1.5       frystyk  1382:              case ":$compile_shlibpath:" in
                   1383:              *":$absdir:"*) ;;
                   1384:              *) compile_shlibpath="$compile_shlibpath$absdir:";;
                   1385:              esac
1.4       frystyk  1386:              compile_command="$compile_command -l$name"
                   1387:              deplibs="$deplibs -l$name"
1.3       frystyk  1388:            else
                   1389:              lib_linked=no
1.4       frystyk  1390:            fi
                   1391:            ;;
1.2       frystyk  1392: 
1.3       frystyk  1393:          *)
                   1394:            lib_linked=no
                   1395:            ;;
1.4       frystyk  1396:          esac
1.2       frystyk  1397: 
1.3       frystyk  1398:          if test "$lib_linked" != yes; then
                   1399:            $echo "$modename: configuration error: unsupported hardcode properties"
                   1400:            exit 1
                   1401:          fi
                   1402: 
1.4       frystyk  1403:          # Finalize command for both is simple: just hardcode it.
                   1404:          if test "$hardcode_direct" = yes; then
                   1405:            finalize_command="$finalize_command $libdir/$linklib"
                   1406:          elif test "$hardcode_minus_L" = yes; then
1.5       frystyk  1407:            case "$finalize_command " in
                   1408:            *" -L$libdir "*) ;;
                   1409:            *) finalize_command="$finalize_command -L$libdir";;
                   1410:            esac
                   1411:            finalize_command="$finalize_command -l$name"
1.4       frystyk  1412:          elif test "$hardcode_shlibpath_var" = yes; then
1.5       frystyk  1413:            case ":$finalize_shlibpath:" in
                   1414:            *":$libdir:"*) ;;
                   1415:            *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
                   1416:            esac
1.4       frystyk  1417:            finalize_command="$finalize_command -l$name"
                   1418:          else
                   1419:            # We cannot seem to hardcode it, guess we'll fake it.
1.5       frystyk  1420:            case "$finalize_command " in
                   1421:            *" -L$dir "*) ;;
                   1422:            *) finalize_command="$finalize_command -L$libdir";;
                   1423:            esac
                   1424:            finalize_command="$finalize_command -l$name"
1.4       frystyk  1425:          fi
                   1426:        else
                   1427:          # Transform directly to old archives if we don't build new libraries.
                   1428:          if test -n "$pic_flag" && test -z "$old_library"; then
                   1429:            $echo "$modename: cannot find static library for \`$arg'" 1>&2
                   1430:            exit 1
                   1431:          fi
1.2       frystyk  1432: 
                   1433:          # Here we assume that one of hardcode_direct or hardcode_minus_L
                   1434:          # is not unsupported.  This is valid on all known static and
                   1435:          # shared platforms.
                   1436:          if test "$hardcode_direct" != unsupported; then
                   1437:            test -n "$old_library" && linklib="$old_library"
                   1438:            compile_command="$compile_command $dir/$linklib"
                   1439:            finalize_command="$finalize_command $dir/$linklib"
                   1440:          else
1.5       frystyk  1441:            case "$compile_command " in
                   1442:            *" -L$dir "*) ;;
                   1443:            *) compile_command="$compile_command -L$dir";;
                   1444:            esac
                   1445:            compile_command="$compile_command -l$name"
                   1446:            case "$finalize_command " in
                   1447:            *" -L$dir "*) ;;
                   1448:            *) finalize_command="$finalize_command -L$dir";;
                   1449:            esac
                   1450:            finalize_command="$finalize_command -l$name"
1.1       frystyk  1451:          fi
1.4       frystyk  1452:        fi
1.2       frystyk  1453: 
                   1454:        # Add in any libraries that this one depends upon.
                   1455:        compile_command="$compile_command$dependency_libs"
                   1456:        finalize_command="$finalize_command$dependency_libs"
1.1       frystyk  1457:        continue
1.4       frystyk  1458:        ;;
1.1       frystyk  1459: 
1.2       frystyk  1460:       # Some other compiler argument.
1.1       frystyk  1461:       *)
1.2       frystyk  1462:        # Unknown arguments in both finalize_command and compile_command need
                   1463:        # to be aesthetically quoted because they are evaled later.
                   1464:        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
                   1465:        case "$arg" in
                   1466:        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)
                   1467:          arg="\"$arg\""
                   1468:          ;;
                   1469:        esac
1.4       frystyk  1470:        ;;
1.1       frystyk  1471:       esac
                   1472: 
1.2       frystyk  1473:       # Now actually substitute the argument into the commands.
                   1474:       if test -n "$arg"; then
                   1475:        compile_command="$compile_command $arg"
                   1476:        finalize_command="$finalize_command $arg"
                   1477:       fi
1.1       frystyk  1478:     done
                   1479: 
                   1480:     if test -n "$prev"; then
1.2       frystyk  1481:       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
                   1482:       $echo "$help" 1>&2
1.1       frystyk  1483:       exit 1
                   1484:     fi
                   1485: 
1.5       frystyk  1486:     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
                   1487:       eval arg=\"$export_dynamic_flag_spec\"
                   1488:       compile_command="$compile_command $arg"
                   1489:       finalize_command="$finalize_command $arg"
1.4       frystyk  1490:     fi
1.5       frystyk  1491: 
1.3       frystyk  1492:     oldlibs=
1.4       frystyk  1493:     # calculate the name of the file, without its directory
                   1494:     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
                   1495:     libobjs_save="$libobjs"
                   1496: 
1.1       frystyk  1497:     case "$output" in
                   1498:     "")
1.2       frystyk  1499:       $echo "$modename: you must specify an output file" 1>&2
                   1500:       $echo "$help" 1>&2
1.1       frystyk  1501:       exit 1
                   1502:       ;;
                   1503: 
1.4       frystyk  1504:     *.a | *.lib)
1.3       frystyk  1505:       if test -n "$link_against_libtool_libs"; then
1.4       frystyk  1506:        $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
                   1507:        exit 1
1.3       frystyk  1508:       fi
                   1509: 
                   1510:       if test -n "$deplibs"; then
1.4       frystyk  1511:        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1.3       frystyk  1512:       fi
                   1513: 
1.5       frystyk  1514:       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1.4       frystyk  1515:        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
1.3       frystyk  1516:       fi
                   1517: 
                   1518:       if test -n "$rpath"; then
1.4       frystyk  1519:        $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
                   1520:       fi
                   1521: 
                   1522:       if test -n "$xrpath"; then
                   1523:        $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
1.3       frystyk  1524:       fi
                   1525: 
                   1526:       if test -n "$vinfo"; then
1.4       frystyk  1527:        $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
1.3       frystyk  1528:       fi
                   1529: 
                   1530:       if test -n "$release"; then
1.4       frystyk  1531:        $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
                   1532:       fi
                   1533: 
1.5       frystyk  1534:       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1.4       frystyk  1535:        $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
1.3       frystyk  1536:       fi
                   1537: 
1.2       frystyk  1538:       # Now set the variables for building old libraries.
                   1539:       build_libtool_libs=no
1.3       frystyk  1540:       oldlibs="$output"
1.2       frystyk  1541:       ;;
                   1542: 
1.1       frystyk  1543:     *.la)
1.2       frystyk  1544:       # Make sure we only generate libraries of the form `libNAME.la'.
1.4       frystyk  1545:       case "$outputname" in
                   1546:       lib*)
                   1547:        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
                   1548:        eval libname=\"$libname_spec\"
                   1549:        ;;
1.2       frystyk  1550:       *)
1.4       frystyk  1551:        if test "$module" = no; then
                   1552:          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
                   1553:          $echo "$help" 1>&2
                   1554:          exit 1
                   1555:        fi
                   1556:        if test "$need_lib_prefix" != no; then
                   1557:          # Add the "lib" prefix for modules if required
                   1558:          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
                   1559:          eval libname=\"$libname_spec\"
                   1560:        else
                   1561:          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
                   1562:        fi
1.2       frystyk  1563:        ;;
                   1564:       esac
                   1565: 
1.4       frystyk  1566:       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
                   1567:       if test "X$output_objdir" = "X$output"; then
                   1568:        output_objdir="$objdir"
                   1569:       else
                   1570:        output_objdir="$output_objdir/$objdir"
                   1571:       fi
1.1       frystyk  1572: 
                   1573:       if test -n "$objs"; then
1.4       frystyk  1574:        $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
                   1575:        exit 1
1.1       frystyk  1576:       fi
                   1577: 
                   1578:       # How the heck are we supposed to write a wrapper for a shared library?
                   1579:       if test -n "$link_against_libtool_libs"; then
1.5       frystyk  1580:         $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
                   1581:         exit 1
1.2       frystyk  1582:       fi
                   1583: 
1.5       frystyk  1584:       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1.4       frystyk  1585:        $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
1.1       frystyk  1586:       fi
                   1587: 
1.2       frystyk  1588:       set dummy $rpath
                   1589:       if test $# -gt 2; then
                   1590:        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
1.1       frystyk  1591:       fi
1.2       frystyk  1592:       install_libdir="$2"
1.1       frystyk  1593: 
1.4       frystyk  1594:       oldlibs=
1.3       frystyk  1595:       if test -z "$rpath"; then
1.4       frystyk  1596:        if test "$build_libtool_libs" = yes; then
                   1597:          # Building a libtool convenience library.
                   1598:          libext=al
                   1599:          oldlibs="$output_objdir/$libname.$libext $oldlibs"
                   1600:          build_libtool_libs=convenience
                   1601:          build_old_libs=yes
                   1602:        fi
                   1603:        dependency_libs="$deplibs"
1.3       frystyk  1604: 
                   1605:        if test -n "$vinfo"; then
                   1606:          $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
                   1607:        fi
                   1608: 
                   1609:        if test -n "$release"; then
                   1610:          $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
                   1611:        fi
                   1612:       else
                   1613: 
                   1614:        # Parse the version information argument.
                   1615:        IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
                   1616:        set dummy $vinfo 0 0 0
                   1617:        IFS="$save_ifs"
                   1618: 
                   1619:        if test -n "$8"; then
                   1620:          $echo "$modename: too many parameters to \`-version-info'" 1>&2
                   1621:          $echo "$help" 1>&2
                   1622:          exit 1
                   1623:        fi
                   1624: 
                   1625:        current="$2"
                   1626:        revision="$3"
                   1627:        age="$4"
                   1628: 
                   1629:        # Check that each of the things are valid numbers.
                   1630:        case "$current" in
                   1631:        0 | [1-9] | [1-9][0-9]*) ;;
                   1632:        *)
                   1633:          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
                   1634:          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
                   1635:          exit 1
                   1636:          ;;
                   1637:        esac
                   1638: 
                   1639:        case "$revision" in
                   1640:        0 | [1-9] | [1-9][0-9]*) ;;
                   1641:        *)
                   1642:          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
                   1643:          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
                   1644:          exit 1
                   1645:          ;;
                   1646:        esac
                   1647: 
                   1648:        case "$age" in
                   1649:        0 | [1-9] | [1-9][0-9]*) ;;
                   1650:        *)
                   1651:          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
                   1652:          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
                   1653:          exit 1
                   1654:          ;;
                   1655:        esac
1.1       frystyk  1656: 
1.3       frystyk  1657:        if test $age -gt $current; then
                   1658:          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
                   1659:          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
                   1660:          exit 1
                   1661:        fi
1.1       frystyk  1662: 
1.3       frystyk  1663:        # Calculate the version variables.
                   1664:        major=
                   1665:        versuffix=
                   1666:        verstring=
                   1667:        case "$version_type" in
                   1668:        none) ;;
                   1669: 
1.5       frystyk  1670:        irix)
                   1671:          major=`expr $current - $age + 1`
                   1672:          versuffix="$major.$revision"
                   1673:          verstring="sgi$major.$revision"
                   1674: 
                   1675:          # Add in all the interfaces that we are compatible with.
                   1676:          loop=$revision
                   1677:          while test $loop != 0; do
                   1678:            iface=`expr $revision - $loop`
                   1679:            loop=`expr $loop - 1`
                   1680:            verstring="sgi$major.$iface:$verstring"
                   1681:          done
                   1682:          ;;
                   1683: 
1.3       frystyk  1684:        linux)
                   1685:          major=.`expr $current - $age`
                   1686:          versuffix="$major.$age.$revision"
                   1687:          ;;
1.1       frystyk  1688: 
1.3       frystyk  1689:        osf)
                   1690:          major=`expr $current - $age`
                   1691:          versuffix=".$current.$age.$revision"
                   1692:          verstring="$current.$age.$revision"
                   1693: 
                   1694:          # Add in all the interfaces that we are compatible with.
                   1695:          loop=$age
                   1696:          while test $loop != 0; do
                   1697:            iface=`expr $current - $loop`
                   1698:            loop=`expr $loop - 1`
                   1699:            verstring="$verstring:${iface}.0"
                   1700:          done
1.1       frystyk  1701: 
1.3       frystyk  1702:          # Make executables depend on our current version.
                   1703:          verstring="$verstring:${current}.0"
                   1704:          ;;
1.1       frystyk  1705: 
1.3       frystyk  1706:        sunos)
                   1707:          major=".$current"
                   1708:          versuffix=".$current.$revision"
                   1709:          ;;
1.1       frystyk  1710: 
1.4       frystyk  1711:        freebsd-aout)
                   1712:          major=".$current"
                   1713:          versuffix=".$current.$revision";
                   1714:          ;;
                   1715: 
                   1716:        freebsd-elf)
                   1717:          major=".$current"
                   1718:          versuffix=".$current";
                   1719:          ;;
                   1720: 
                   1721:        windows)
                   1722:          # Like Linux, but with '-' rather than '.', since we only
                   1723:          # want one extension on Windows 95.
                   1724:          major=`expr $current - $age`
                   1725:          versuffix="-$major-$age-$revision"
                   1726:          ;;
                   1727: 
1.3       frystyk  1728:        *)
                   1729:          $echo "$modename: unknown library version type \`$version_type'" 1>&2
                   1730:          echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
                   1731:          exit 1
                   1732:          ;;
                   1733:        esac
1.1       frystyk  1734: 
1.3       frystyk  1735:        # Clear the version info if we defaulted, and they specified a release.
                   1736:        if test -z "$vinfo" && test -n "$release"; then
                   1737:          major=
                   1738:          verstring="0.0"
1.4       frystyk  1739:          if test "$need_version" = no; then
                   1740:            versuffix=
                   1741:          else
                   1742:            versuffix=".0.0"
                   1743:          fi
1.3       frystyk  1744:        fi
1.1       frystyk  1745: 
1.4       frystyk  1746:        # Remove version info from name if versioning should be avoided
                   1747:        if test "$avoid_version" = yes && test "$need_version" = no; then
                   1748:          major=
                   1749:          versuffix=
                   1750:          verstring=""
                   1751:        fi
                   1752:        
1.3       frystyk  1753:        # Check to see if the archive will have undefined symbols.
                   1754:        if test "$allow_undefined" = yes; then
                   1755:          if test "$allow_undefined_flag" = unsupported; then
                   1756:            $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
                   1757:            build_libtool_libs=no
                   1758:            build_old_libs=yes
                   1759:          fi
                   1760:        else
                   1761:          # Don't allow undefined symbols.
                   1762:          allow_undefined_flag="$no_undefined_flag"
                   1763:        fi
1.1       frystyk  1764: 
1.3       frystyk  1765:        dependency_libs="$deplibs"
1.4       frystyk  1766:        case "$host" in
1.5       frystyk  1767:        *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1.4       frystyk  1768:          # these systems don't actually have a c library (as such)!
                   1769:          ;;
                   1770:        *)
                   1771:          # Add libc to deplibs on all other systems.
                   1772:          deplibs="$deplibs -lc"
                   1773:          ;;
                   1774:        esac
1.3       frystyk  1775:       fi
1.1       frystyk  1776: 
                   1777:       # Create the output directory, or remove our outputs if we need to.
1.4       frystyk  1778:       if test -d $output_objdir; then
                   1779:        $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
                   1780:        $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
1.1       frystyk  1781:       else
1.4       frystyk  1782:        $show "$mkdir $output_objdir"
                   1783:        $run $mkdir $output_objdir
                   1784:        status=$?
                   1785:        if test $status -ne 0 && test ! -d $output_objdir; then
                   1786:          exit $status
                   1787:        fi
                   1788:       fi
                   1789: 
                   1790:       # Now set the variables for building old libraries.
                   1791:       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
                   1792:        oldlibs="$oldlibs $output_objdir/$libname.$libext"
                   1793: 
                   1794:        # Transform .lo files to .o files.
                   1795:        oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
                   1796:       fi
                   1797: 
                   1798:       if test "$build_libtool_libs" = yes; then
                   1799:        # Transform deplibs into only deplibs that can be linked in shared.
                   1800:        name_save=$name
                   1801:        libname_save=$libname
                   1802:        release_save=$release
                   1803:        versuffix_save=$versuffix
                   1804:        major_save=$major
                   1805:        # I'm not sure if I'm treating the release correctly.  I think
                   1806:        # release should show up in the -l (ie -lgmp5) so we don't want to
                   1807:        # add it in twice.  Is that correct?
                   1808:        release=""
                   1809:        versuffix=""
                   1810:        major=""
                   1811:        newdeplibs=
                   1812:        droppeddeps=no
                   1813:        case "$deplibs_check_method" in
                   1814:        pass_all)
1.5       frystyk  1815:          # Don't check for shared/static.  Everything works.
                   1816:          # This might be a little naive.  We might want to check
                   1817:          # whether the library exists or not.  But this is on
                   1818:          # osf3 & osf4 and I'm not really sure... Just
                   1819:          # implementing what was already the behaviour.
1.4       frystyk  1820:          newdeplibs=$deplibs
1.5       frystyk  1821:          ;;
1.4       frystyk  1822:        test_compile)
                   1823:          # This code stresses the "libraries are programs" paradigm to its
                   1824:          # limits. Maybe even breaks it.  We compile a program, linking it
                   1825:          # against the deplibs as a proxy for the library.  Then we can check
                   1826:          # whether they linked in statically or dynamically with ldd.
                   1827:          $rm conftest.c
                   1828:          cat > conftest.c <<EOF
                   1829:          int main() { return 0; }
                   1830: EOF
                   1831:          $rm conftest
                   1832:          $C_compiler -o conftest conftest.c $deplibs
                   1833:          if test $? -eq 0 ; then
                   1834:            ldd_output=`ldd conftest`
                   1835:            for i in $deplibs; do
                   1836:              name="`expr $i : '-l\(.*\)'`"
                   1837:              # If $name is empty we are operating on a -L argument.
                   1838:              if test "$name" != "" ; then
                   1839:                libname=`eval \\$echo \"$libname_spec\"`
                   1840:                deplib_matches=`eval \\$echo \"$library_names_spec\"`
                   1841:                set dummy $deplib_matches
                   1842:                deplib_match=$2
                   1843:                if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
                   1844:                  newdeplibs="$newdeplibs $i"
                   1845:                else
                   1846:                  droppeddeps=yes
                   1847:                  echo
                   1848:                  echo "*** Warning: This library needs some functionality provided by $i."
                   1849:                  echo "*** I have the capability to make that library automatically link in when"
                   1850:                  echo "*** you link to this library.  But I can only do this if you have a"
                   1851:                  echo "*** shared version of the library, which you do not appear to have."
                   1852:                fi
                   1853:              else
                   1854:                newdeplibs="$newdeplibs $i"
                   1855:              fi
                   1856:            done
                   1857:          else
                   1858:            # Error occured in the first compile.  Let's try to salvage the situation:
                   1859:            # Compile a seperate program for each library.
                   1860:            for i in $deplibs; do
                   1861:              name="`expr $i : '-l\(.*\)'`"
                   1862:             # If $name is empty we are operating on a -L argument.
                   1863:              if test "$name" != "" ; then
                   1864:                $rm conftest
                   1865:                $C_compiler -o conftest conftest.c $i
                   1866:                # Did it work?
                   1867:                if test $? -eq 0 ; then
                   1868:                  ldd_output=`ldd conftest`
1.5       frystyk  1869:                  libname=`eval \\$echo \"$libname_spec\"`
                   1870:                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
                   1871:                  set dummy $deplib_matches
                   1872:                  deplib_match=$2
                   1873:                  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
                   1874:                    newdeplibs="$newdeplibs $i"
                   1875:                  else
                   1876:                    droppeddeps=yes
                   1877:                    echo
                   1878:                    echo "*** Warning: This library needs some functionality provided by $i."
                   1879:                    echo "*** I have the capability to make that library automatically link in when"
                   1880:                    echo "*** you link to this library.  But I can only do this if you have a"
                   1881:                    echo "*** shared version of the library, which you do not appear to have."
                   1882:                  fi
1.4       frystyk  1883:                else
                   1884:                  droppeddeps=yes
                   1885:                  echo
                   1886:                  echo "*** Warning!  Library $i is needed by this library but I was not able to"
                   1887:                  echo "***  make it link in!  You will probably need to install it or some"
                   1888:                  echo "*** library that it depends on before this library will be fully"
                   1889:                  echo "*** functional.  Installing it before continuing would be even better."
                   1890:                fi
                   1891:              else
                   1892:                newdeplibs="$newdeplibs $i"
                   1893:              fi
                   1894:            done
                   1895:          fi
                   1896:          ;;
1.5       frystyk  1897:        file_magic*)
1.4       frystyk  1898:          set dummy $deplibs_check_method
                   1899:          file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
                   1900:          for a_deplib in $deplibs; do
                   1901:            name="`expr $a_deplib : '-l\(.*\)'`"
                   1902:            # If $name is empty we are operating on a -L argument.
                   1903:            if test "$name" != "" ; then
                   1904:              libname=`eval \\$echo \"$libname_spec\"`
1.5       frystyk  1905:              for i in $lib_search_path; do
1.4       frystyk  1906:                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
                   1907:                    for potent_lib in $potential_libs; do
                   1908:                      # Follow soft links.
1.6     ! frystyk  1909:                      if ls -lLd "$potent_lib" 2>/dev/null \
1.4       frystyk  1910:                         | grep " -> " >/dev/null; then
                   1911:                        continue 
                   1912:                      fi
                   1913:                      # The statement above tries to avoid entering an
                   1914:                      # endless loop below, in case of cyclic links.
                   1915:                      # We might still enter an endless loop, since a link
                   1916:                      # loop can be closed while we follow links,
                   1917:                      # but so what?
                   1918:                      potlib="$potent_lib"
                   1919:                      while test -h "$potlib" 2>/dev/null; do
1.5       frystyk  1920:                        potliblink=`ls -ld $potlib | sed 's/.* -> //'`
1.4       frystyk  1921:                        case "$potliblink" in
1.5       frystyk  1922:                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
                   1923:                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
1.4       frystyk  1924:                        esac
                   1925:                      done
1.5       frystyk  1926:                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
                   1927:                         | sed 10q \
                   1928:                         | egrep "$file_magic_regex" > /dev/null; then
1.4       frystyk  1929:                        newdeplibs="$newdeplibs $a_deplib"
                   1930:                        a_deplib=""
                   1931:                        break 2
                   1932:                      fi
                   1933:                    done
1.5       frystyk  1934:              done
1.4       frystyk  1935:              if test -n "$a_deplib" ; then
                   1936:                droppeddeps=yes
                   1937:                echo
                   1938:                echo "*** Warning: This library needs some functionality provided by $a_deplib."
                   1939:                echo "*** I have the capability to make that library automatically link in when"
                   1940:                echo "*** you link to this library.  But I can only do this if you have a"
                   1941:                echo "*** shared version of the library, which you do not appear to have."
                   1942:              fi
                   1943:            else
                   1944:              # Add a -L argument.
                   1945:              newdeplibs="$newdeplibs $a_deplib"
                   1946:            fi
                   1947:          done # Gone through all deplibs.
                   1948:          ;;
1.5       frystyk  1949:        none | unknown | *)
                   1950:          newdeplibs=""
                   1951:          if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
                   1952:               -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
                   1953:             grep . >/dev/null; then
                   1954:            echo
                   1955:            if test "X$deplibs_check_method" = "Xnone"; then
                   1956:              echo "*** Warning: inter-library dependencies are not supported in this platform."
                   1957:            else
                   1958:              echo "*** Warning: inter-library dependencies are not known to be supported."
                   1959:            fi
                   1960:            echo "*** All declared inter-library dependencies are being dropped."
                   1961:            droppeddeps=yes
                   1962:          fi
                   1963:          ;;
1.4       frystyk  1964:        esac
                   1965:        versuffix=$versuffix_save
                   1966:        major=$major_save
                   1967:        release=$release_save
                   1968:        libname=$libname_save
                   1969:        name=$name_save
                   1970: 
1.5       frystyk  1971:        if test "$droppeddeps" = yes; then
                   1972:          if test "$module" = yes; then
1.4       frystyk  1973:            echo
1.5       frystyk  1974:            echo "*** Warning: libtool could not satisfy all declared inter-library"
                   1975:            echo "*** dependencies of module $libname.  Therefore, libtool will create"
                   1976:            echo "*** a static module, that should work as long as the dlopening"
                   1977:            echo "*** application is linked with the -dlopen flag."
                   1978:            if test -z "$global_symbol_pipe"; then
                   1979:              echo
                   1980:              echo "*** However, this would only work if libtool was able to extract symbol"
                   1981:              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
                   1982:              echo "*** not find such a program.  So, this module is probably useless."
                   1983:              echo "*** \`nm' from GNU binutils and a full rebuild may help."
                   1984:            fi
                   1985:            if test "$build_old_libs" = no; then
                   1986:              oldlibs="$output_objdir/$libname.$libext"
                   1987:              build_libtool_libs=module
                   1988:              build_old_libs=yes
                   1989:            else
                   1990:              build_libtool_libs=no
                   1991:            fi
1.4       frystyk  1992:          else
1.5       frystyk  1993:            echo "*** The inter-library dependencies that have been dropped here will be"
                   1994:            echo "*** automatically added whenever a program is linked with this library"
                   1995:            echo "*** or is declared to -dlopen it."
1.4       frystyk  1996:          fi
                   1997:        fi
1.5       frystyk  1998:        # Done checking deplibs!
                   1999:        deplibs=$newdeplibs
1.1       frystyk  2000:       fi
                   2001: 
1.5       frystyk  2002:       # All the library-specific variables (install_libdir is set above).
                   2003:       library_names=
                   2004:       old_library=
                   2005:       dlname=
                   2006:       
                   2007:       # Test again, we may have decided not to build it any more
1.1       frystyk  2008:       if test "$build_libtool_libs" = yes; then
1.3       frystyk  2009:        # Get the real and link names of the library.
                   2010:        eval library_names=\"$library_names_spec\"
                   2011:        set dummy $library_names
                   2012:        realname="$2"
                   2013:        shift; shift
1.1       frystyk  2014: 
1.3       frystyk  2015:        if test -n "$soname_spec"; then
                   2016:          eval soname=\"$soname_spec\"
                   2017:        else
                   2018:          soname="$realname"
                   2019:        fi
1.1       frystyk  2020: 
1.4       frystyk  2021:        lib="$output_objdir/$realname"
1.1       frystyk  2022:        for link
                   2023:        do
                   2024:          linknames="$linknames $link"
                   2025:        done
                   2026: 
1.5       frystyk  2027:        # Ensure that we have .o objects for linkers which dislike .lo
                   2028:        # (e.g. aix) incase we are running --disable-static
                   2029:        for obj in $libobjs; do
                   2030:          oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"`
                   2031:          if test ! -f $oldobj; then
                   2032:            $show "${LN_S} $obj $oldobj"
                   2033:            $run ${LN_S} $obj $oldobj || exit $?
                   2034:          fi
                   2035:        done
                   2036: 
                   2037:        # Use standard objects if they are pic
1.4       frystyk  2038:        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1.3       frystyk  2039: 
                   2040:        if test -n "$whole_archive_flag_spec"; then
                   2041:          if test -n "$convenience"; then
                   2042:            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
                   2043:          fi
                   2044:        else
1.5       frystyk  2045:          gentop="$output_objdir/${outputname}x"
                   2046:          $show "${rm}r $gentop"
                   2047:          $run ${rm}r "$gentop"
                   2048:          $show "mkdir $gentop"
                   2049:          $run mkdir "$gentop"
                   2050:          status=$?
                   2051:          if test $status -ne 0 && test ! -d "$gentop"; then
                   2052:            exit $status
                   2053:          fi
                   2054:          generated="$generated $gentop"
                   2055:          
1.3       frystyk  2056:          for xlib in $convenience; do
                   2057:            # Extract the objects.
1.5       frystyk  2058:            case "$xlib" in
                   2059:            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
                   2060:            *) xabs=`pwd`"/$xlib" ;;
                   2061:            esac
                   2062:            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
                   2063:            xdir="$gentop/$xlib"
1.3       frystyk  2064: 
                   2065:            $show "${rm}r $xdir"
                   2066:            $run ${rm}r "$xdir"
                   2067:            $show "mkdir $xdir"
                   2068:            $run mkdir "$xdir"
                   2069:            status=$?
                   2070:            if test $status -ne 0 && test ! -d "$xdir"; then
                   2071:              exit $status
                   2072:            fi
1.5       frystyk  2073:            $show "(cd $xdir && $AR x $xabs)"
                   2074:            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
1.1       frystyk  2075: 
1.4       frystyk  2076:            libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
1.3       frystyk  2077:          done
                   2078:        fi
                   2079: 
1.5       frystyk  2080:        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
                   2081:          eval flag=\"$thread_safe_flag_spec\"
                   2082:          linkopts="$linkopts $flag"
                   2083:        fi
                   2084: 
                   2085:        # Prepare the list of exported symbols
                   2086:        if test -z "$export_symbols"; then
                   2087:          if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
                   2088:            $show "generating symbol list for \`$libname.la'"
                   2089:            export_symbols="$output_objdir/$libname.exp"
                   2090:            $run $rm $export_symbols
                   2091:            eval cmds=\"$export_symbols_cmds\"
                   2092:            IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
                   2093:            for cmd in $cmds; do
                   2094:              IFS="$save_ifs"
                   2095:              $show "$cmd"
                   2096:              $run eval "$cmd" || exit $?
                   2097:            done
                   2098:            IFS="$save_ifs"
                   2099:            if test -n "$export_symbols_regex"; then
                   2100:              $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
                   2101:              $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
                   2102:              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
                   2103:              $run eval '$mv "${export_symbols}T" "$export_symbols"'
                   2104:            fi
                   2105:          fi
                   2106:        fi
                   2107: 
                   2108:        if test -n "$export_symbols" && test -n "$include_expsyms"; then
                   2109:          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
                   2110:        fi
                   2111: 
1.3       frystyk  2112:        # Do each of the archive commands.
1.5       frystyk  2113:        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
                   2114:          eval cmds=\"$archive_expsym_cmds\"
1.4       frystyk  2115:        else
                   2116:          eval cmds=\"$archive_cmds\"
                   2117:        fi
                   2118:        IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
1.3       frystyk  2119:        for cmd in $cmds; do
                   2120:          IFS="$save_ifs"
                   2121:          $show "$cmd"
                   2122:          $run eval "$cmd" || exit $?
                   2123:        done
                   2124:        IFS="$save_ifs"
1.1       frystyk  2125: 
1.3       frystyk  2126:        # Create links to the real library.
                   2127:        for linkname in $linknames; do
                   2128:          if test "$realname" != "$linkname"; then
1.4       frystyk  2129:            $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
                   2130:            $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
1.3       frystyk  2131:          fi
                   2132:        done
1.1       frystyk  2133: 
1.4       frystyk  2134:        # If -module or -export-dynamic was specified, set the dlname.
                   2135:        if test "$module" = yes || test "$export_dynamic" = yes; then
1.3       frystyk  2136:          # On all known operating systems, these are identical.
                   2137:          dlname="$soname"
                   2138:        fi
1.1       frystyk  2139:       fi
                   2140:       ;;
                   2141: 
1.4       frystyk  2142:     *.lo | *.o | *.obj)
1.1       frystyk  2143:       if test -n "$link_against_libtool_libs"; then
1.4       frystyk  2144:        $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
                   2145:        exit 1
1.1       frystyk  2146:       fi
                   2147: 
                   2148:       if test -n "$deplibs"; then
1.4       frystyk  2149:        $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
1.1       frystyk  2150:       fi
                   2151: 
1.5       frystyk  2152:       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1.4       frystyk  2153:        $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
1.2       frystyk  2154:       fi
                   2155: 
                   2156:       if test -n "$rpath"; then
1.4       frystyk  2157:        $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
                   2158:       fi
                   2159: 
                   2160:       if test -n "$xrpath"; then
                   2161:        $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
1.1       frystyk  2162:       fi
                   2163: 
                   2164:       if test -n "$vinfo"; then
1.4       frystyk  2165:        $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
1.2       frystyk  2166:       fi
                   2167: 
                   2168:       if test -n "$release"; then
1.4       frystyk  2169:        $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
1.1       frystyk  2170:       fi
                   2171: 
                   2172:       case "$output" in
                   2173:       *.lo)
1.4       frystyk  2174:        if test -n "$objs"; then
                   2175:          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
                   2176:          exit 1
                   2177:        fi
                   2178:        libobj="$output"
                   2179:        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
                   2180:        ;;
1.1       frystyk  2181:       *)
1.4       frystyk  2182:        libobj=
                   2183:        obj="$output"
                   2184:        ;;
1.1       frystyk  2185:       esac
                   2186: 
                   2187:       # Delete the old objects.
                   2188:       $run $rm $obj $libobj
                   2189: 
                   2190:       # Create the old-style object.
1.4       frystyk  2191:       reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
1.1       frystyk  2192: 
                   2193:       output="$obj"
1.3       frystyk  2194:       eval cmds=\"$reload_cmds\"
1.4       frystyk  2195:       IFS="${IFS=      }"; save_ifs="$IFS"; IFS='~'
1.1       frystyk  2196:       for cmd in $cmds; do
1.4       frystyk  2197:        IFS="$save_ifs"
                   2198:        $show "$cmd"
                   2199:        $run eval "$cmd" || exit $?
1.1       frystyk  2200:       done
                   2201:       IFS="$save_ifs"
                   2202: 
                   2203:       # Exit if we aren't doing a library object file.
                   2204:       test -z "$libobj" && exit 0
                   2205: 
                   2206:       if test "$build_libtool_libs" != yes; then
1.4       frystyk  2207:        # Create an invalid libtool object if no PIC, so that we don't
                   2208:        # accidentally link it into a program.
                   2209:        $show "echo timestamp > $libobj"
                   2210:        $run eval "echo timestamp > $libobj" || exit $?
                   2211:        exit 0
1.1       frystyk  2212:       fi
                   2213: 
                   2214:       if test -n "$pic_flag"; then
1.4       frystyk  2215:        # Only do commands if we really have different PIC objects.
                   2216:        reload_objs="$libobjs"
                   2217:        output="$libobj"
                   2218:        eval cmds=\"$reload_cmds\"
                   2219:        IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
                   2220:        for cmd in $cmds; do
                   2221:          IFS="$save_ifs"
                   2222:          $show "$cmd"
                   2223:          $run eval "$cmd" || exit $?
                   2224:        done
                   2225:        IFS="$save_ifs"
1.1       frystyk  2226:       else
1.4       frystyk  2227:        # Just create a symlink.
                   2228:        $show $rm $libobj
                   2229:        $run $rm $libobj
                   2230:        $show "$LN_S $obj $libobj"
                   2231:        $run $LN_S $obj $libobj || exit $?
1.1       frystyk  2232:       fi
                   2233: 
                   2234:       exit 0
                   2235:       ;;
                   2236: 
1.4       frystyk  2237:     # Anything else should be a program.
1.1       frystyk  2238:     *)
1.2       frystyk  2239:       if test -n "$vinfo"; then
1.4       frystyk  2240:        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
1.1       frystyk  2241:       fi
                   2242: 
1.2       frystyk  2243:       if test -n "$release"; then
1.4       frystyk  2244:        $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
1.1       frystyk  2245:       fi
                   2246: 
1.5       frystyk  2247:       if test "$preload" = yes; then
                   2248:        if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
                   2249:           test "$dlopen_self_static" = unknown; then
                   2250:          $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
                   2251:        fi 
                   2252:       fi
                   2253:     
1.4       frystyk  2254:       if test -n "$rpath$xrpath"; then
1.2       frystyk  2255:        # If the user specified any rpath flags, then add them.
1.4       frystyk  2256:        for libdir in $rpath $xrpath; do
1.5       frystyk  2257:          # This is the magic to use -rpath.
                   2258:          case "$compile_rpath " in
                   2259:          *" $libdir "*) ;;
                   2260:          *) compile_rpath="$compile_rpath $libdir" ;;
                   2261:          esac
                   2262:          case "$finalize_rpath " in
                   2263:          *" $libdir "*) ;;
                   2264:          *) finalize_rpath="$finalize_rpath $libdir" ;;
                   2265:          esac
                   2266:        done
                   2267:       fi
1.4       frystyk  2268: 
1.5       frystyk  2269:       # Now hardcode the library paths
                   2270:       rpath=
                   2271:       hardcode_libdirs=
                   2272:       for libdir in $compile_rpath $finalize_rpath; do
                   2273:        if test -n "$hardcode_libdir_flag_spec"; then
                   2274:          if test -n "$hardcode_libdir_separator"; then
                   2275:            if test -z "$hardcode_libdirs"; then
                   2276:              hardcode_libdirs="$libdir"
                   2277:            else
                   2278:              # Just accumulate the unique libdirs.
                   2279:              case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
                   2280:              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
                   2281:                ;;
                   2282:              *)
                   2283:                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
                   2284:                ;;
                   2285:              esac
1.4       frystyk  2286:            fi
1.5       frystyk  2287:          else
                   2288:            eval flag=\"$hardcode_libdir_flag_spec\"
                   2289:            rpath="$rpath $flag"
                   2290:          fi
                   2291:        elif test -n "$runpath_var"; then
                   2292:          case "$perm_rpath " in
                   2293:          *" $libdir "*) ;;
                   2294:          *) perm_rpath="$perm_rpath $libdir" ;;
                   2295:          esac
                   2296:        fi
                   2297:       done
                   2298:       # Substitute the hardcoded libdirs into the rpath.
                   2299:       if test -n "$hardcode_libdir_separator" &&
                   2300:         test -n "$hardcode_libdirs"; then
                   2301:        libdir="$hardcode_libdirs"
                   2302:        eval rpath=\" $hardcode_libdir_flag_spec\"
                   2303:       fi
                   2304:       compile_rpath="$rpath"
                   2305: 
                   2306:       rpath=
                   2307:       hardcode_libdirs=
                   2308:       for libdir in $finalize_rpath; do
                   2309:        if test -n "$hardcode_libdir_flag_spec"; then
                   2310:          if test -n "$hardcode_libdir_separator"; then
                   2311:            if test -z "$hardcode_libdirs"; then
                   2312:              hardcode_libdirs="$libdir"
                   2313:            else
                   2314:              # Just accumulate the unique libdirs.
                   2315:              case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
                   2316:              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
                   2317:                ;;
                   2318:              *)
                   2319:                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
                   2320:                ;;
                   2321:              esac
1.4       frystyk  2322:            fi
1.5       frystyk  2323:          else
                   2324:            eval flag=\"$hardcode_libdir_flag_spec\"
                   2325:            rpath="$rpath $flag"
1.4       frystyk  2326:          fi
1.5       frystyk  2327:        elif test -n "$runpath_var"; then
                   2328:          case "$finalize_perm_rpath " in
                   2329:          *" $libdir "*) ;;
                   2330:          *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
                   2331:          esac
                   2332:        fi
                   2333:       done
                   2334:       # Substitute the hardcoded libdirs into the rpath.
                   2335:       if test -n "$hardcode_libdir_separator" &&
                   2336:         test -n "$hardcode_libdirs"; then
                   2337:        libdir="$hardcode_libdirs"
                   2338:        eval rpath=\" $hardcode_libdir_flag_spec\"
1.4       frystyk  2339:       fi
1.5       frystyk  2340:       finalize_rpath="$rpath"
1.4       frystyk  2341: 
                   2342:       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
                   2343:       if test "X$output_objdir" = "X$output"; then
                   2344:        output_objdir="$objdir"
                   2345:       else
                   2346:        output_objdir="$output_objdir/$objdir"
1.2       frystyk  2347:       fi
                   2348: 
1.5       frystyk  2349:       # Create the binary in the object directory, then wrap it.
                   2350:       if test ! -d $output_objdir; then
                   2351:        $show "$mkdir $output_objdir"
                   2352:        $run $mkdir $output_objdir
                   2353:        status=$?
                   2354:        if test $status -ne 0 && test ! -d $output_objdir; then
                   2355:          exit $status
                   2356:        fi
                   2357:       fi
                   2358: 
1.2       frystyk  2359:       if test -n "$libobjs" && test "$build_old_libs" = yes; then
1.4       frystyk  2360:        # Transform all the library objects into standard objects.
                   2361:        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
                   2362:        finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1.2       frystyk  2363:       fi
                   2364: 
1.5       frystyk  2365:       dlsyms=
                   2366:       if test -n "$dlfiles$dlprefiles" || test "$dlself" = yes; then
                   2367:        if test -n "$NM" && test -n "$global_symbol_pipe"; then
                   2368:          dlsyms="${outputname}S.c"
                   2369:        else
                   2370:          $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
                   2371:        fi
1.2       frystyk  2372:       fi
                   2373: 
                   2374:       if test -n "$dlsyms"; then
1.4       frystyk  2375:        case "$dlsyms" in
                   2376:        "") ;;
                   2377:        *.c)
                   2378:          # Discover the nlist of each of the dlfiles.
1.5       frystyk  2379:          nlist="$output_objdir/${outputname}.nm"
1.1       frystyk  2380: 
1.5       frystyk  2381:          $show "$rm $nlist ${nlist}S ${nlist}T"
                   2382:          $run $rm "$nlist" "${nlist}S" "${nlist}T"
1.2       frystyk  2383: 
1.4       frystyk  2384:          # Parse the name list into a source file.
1.5       frystyk  2385:          $show "creating $output_objdir/$dlsyms"
1.2       frystyk  2386: 
1.5       frystyk  2387:          test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
1.4       frystyk  2388: /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
                   2389: /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
1.2       frystyk  2390: 
                   2391: #ifdef __cplusplus
                   2392: extern \"C\" {
                   2393: #endif
                   2394: 
                   2395: /* Prevent the only kind of declaration conflicts we can make. */
1.4       frystyk  2396: #define lt_preloaded_symbols some_other_symbol
1.2       frystyk  2397: 
1.3       frystyk  2398: /* External symbol declarations for the compiler. */\
                   2399: "
1.2       frystyk  2400: 
1.5       frystyk  2401:          if test "$dlself" = yes; then
                   2402:            $show "generating symbol list for \`$output'"
                   2403: 
                   2404:            test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
                   2405: 
                   2406:            # Add our own program objects to the symbol list.
                   2407:            progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
                   2408:            for arg in $progfiles; do
                   2409:              $show "extracting global C symbols from \`$arg'"
                   2410:              $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
                   2411:            done
                   2412: 
                   2413:            if test -n "$exclude_expsyms"; then
                   2414:              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
                   2415:              $run eval '$mv "$nlist"T "$nlist"'
                   2416:            fi
                   2417:            
                   2418:            if test -n "$export_symbols_regex"; then
                   2419:              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
                   2420:              $run eval '$mv "$nlist"T "$nlist"'
                   2421:            fi
                   2422: 
                   2423:            # Prepare the list of exported symbols
                   2424:            if test -z "$export_symbols"; then
                   2425:              export_symbols="$output_objdir/$output.exp"
                   2426:              $run $rm $export_symbols
                   2427:              $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
                   2428:            else
                   2429:              $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
                   2430:              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
                   2431:              $run eval 'mv "$nlist"T "$nlist"'
                   2432:            fi
1.4       frystyk  2433:          fi
                   2434: 
                   2435:          for arg in $dlprefiles; do
                   2436:            $show "extracting global C symbols from \`$arg'"
1.5       frystyk  2437:            name=`echo "$arg" | sed -e 's%^.*/%%'`
                   2438:            $run eval 'echo ": $name " >> "$nlist"'
1.4       frystyk  2439:            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
                   2440:          done
                   2441: 
                   2442:          if test -z "$run"; then
                   2443:            # Make sure we have at least an empty file.
                   2444:            test -f "$nlist" || : > "$nlist"
                   2445: 
1.5       frystyk  2446:            if test -n "$exclude_expsyms"; then
                   2447:              egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
                   2448:              $mv "$nlist"T "$nlist"
                   2449:            fi
                   2450: 
1.4       frystyk  2451:            # Try sorting and uniquifying the output.
1.5       frystyk  2452:            if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
                   2453:              :
1.4       frystyk  2454:            else
1.5       frystyk  2455:              grep -v "^: " < "$nlist" > "$nlist"S
1.4       frystyk  2456:            fi
                   2457: 
1.5       frystyk  2458:            if test -f "$nlist"S; then
                   2459:              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
1.2       frystyk  2460:            else
1.4       frystyk  2461:              echo '/* NONE */' >> "$output_objdir/$dlsyms"
1.2       frystyk  2462:            fi
                   2463: 
1.4       frystyk  2464:            $echo >> "$output_objdir/$dlsyms" "\
1.3       frystyk  2465: 
1.4       frystyk  2466: #undef lt_preloaded_symbols
1.2       frystyk  2467: 
                   2468: #if defined (__STDC__) && __STDC__
1.4       frystyk  2469: # define lt_ptr_t void *
1.2       frystyk  2470: #else
1.4       frystyk  2471: # define lt_ptr_t char *
                   2472: # define const
1.2       frystyk  2473: #endif
                   2474: 
                   2475: /* The mapping between symbol names and symbols. */
1.4       frystyk  2476: const struct {
                   2477:   const char *name;
                   2478:   lt_ptr_t address;
1.2       frystyk  2479: }
1.4       frystyk  2480: lt_preloaded_symbols[] =
1.3       frystyk  2481: {\
                   2482: "
1.2       frystyk  2483: 
1.5       frystyk  2484:            sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
                   2485:                -e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
                   2486:                  < "$nlist" >> "$output_objdir/$dlsyms"
1.4       frystyk  2487: 
                   2488:            $echo >> "$output_objdir/$dlsyms" "\
                   2489:   {0, (lt_ptr_t) 0}
1.2       frystyk  2490: };
                   2491: 
1.4       frystyk  2492: /* This works around a problem in FreeBSD linker */
1.5       frystyk  2493: #ifdef FREEBSD_WORKAROUND
1.4       frystyk  2494: static const void *lt_preloaded_setup() {
                   2495:   return lt_preloaded_symbols;
                   2496: }
1.5       frystyk  2497: #endif
1.4       frystyk  2498: 
1.2       frystyk  2499: #ifdef __cplusplus
                   2500: }
1.3       frystyk  2501: #endif\
                   2502: "
1.4       frystyk  2503:          fi
1.2       frystyk  2504: 
1.5       frystyk  2505:          pic_flag_for_symtable=
                   2506:          case "$host" in
                   2507:          # compiling the symbol table file with pic_flag works around
                   2508:          # a FreeBSD bug that causes programs to crash when -lm is
                   2509:          # linked before any other PIC object.  But we must not use
                   2510:          # pic_flag when linking with -static.  The problem exists in
                   2511:          # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
                   2512:          *-*-freebsd2*|*-*-freebsd3.0*)
                   2513:            case "$compile_command " in
                   2514:            *" -static "*) ;;
                   2515:            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
                   2516:            esac
                   2517:          esac
                   2518: 
1.4       frystyk  2519:          # Now compile the dynamic symbol file.
1.5       frystyk  2520:          $show "(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
                   2521:          $run eval '(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
                   2522: 
                   2523:          # Clean up the generated files.
                   2524:          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
                   2525:          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
1.4       frystyk  2526: 
                   2527:          # Transform the symbol file into the correct name.
1.5       frystyk  2528:          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
                   2529:          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
1.4       frystyk  2530:          ;;
                   2531:        *)
                   2532:          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
                   2533:          exit 1
                   2534:          ;;
                   2535:        esac
                   2536:       else
                   2537:        # We keep going just in case the user didn't refer to
                   2538:        # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
                   2539:        # really was required.
1.2       frystyk  2540: 
1.4       frystyk  2541:        # Nullify the symbol file.
                   2542:        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
                   2543:        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1.2       frystyk  2544:       fi
                   2545: 
                   2546:       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
1.4       frystyk  2547:        # Replace the output file specification.
                   2548:        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
1.5       frystyk  2549:        link_command="$compile_command$compile_rpath"
1.4       frystyk  2550: 
                   2551:        # We have no uninstalled library dependencies, so finalize right now.
1.5       frystyk  2552:        $show "$link_command"
                   2553:        $run eval "$link_command"
1.2       frystyk  2554:        status=$?
1.5       frystyk  2555:        
                   2556:        # Delete the generated files.
                   2557:        if test -n "$dlsyms"; then
                   2558:          $show "$rm $output_objdir/${outputname}S.${objext}"
                   2559:          $run $rm "$output_objdir/${outputname}S.${objext}"
1.2       frystyk  2560:        fi
1.5       frystyk  2561: 
                   2562:        exit $status
1.1       frystyk  2563:       fi
                   2564: 
                   2565:       if test -n "$shlibpath_var"; then
1.4       frystyk  2566:        # We should set the shlibpath_var
                   2567:        rpath=
                   2568:        for dir in $temp_rpath; do
                   2569:          case "$dir" in
1.5       frystyk  2570:          [\\/]* | [A-Za-z]:[\\/]*)
1.4       frystyk  2571:            # Absolute path.
                   2572:            rpath="$rpath$dir:"
                   2573:            ;;
                   2574:          *)
                   2575:            # Relative path: add a thisdir entry.
                   2576:            rpath="$rpath\$thisdir/$dir:"
                   2577:            ;;
                   2578:          esac
                   2579:        done
                   2580:        temp_rpath="$rpath"
1.1       frystyk  2581:       fi
                   2582: 
1.5       frystyk  2583:       if test -n "$compile_shlibpath$finalize_shlibpath"; then
                   2584:        compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
1.1       frystyk  2585:       fi
                   2586:       if test -n "$finalize_shlibpath"; then
1.4       frystyk  2587:        finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
1.1       frystyk  2588:       fi
                   2589: 
1.5       frystyk  2590:       compile_var=
                   2591:       finalize_var=
1.4       frystyk  2592:       if test -n "$runpath_var"; then
1.5       frystyk  2593:        if test -n "$perm_rpath"; then
1.4       frystyk  2594:          # We should set the runpath_var.
                   2595:          rpath=
                   2596:          for dir in $perm_rpath; do
                   2597:            rpath="$rpath$dir:"
                   2598:          done
1.5       frystyk  2599:          compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
1.4       frystyk  2600:        fi
1.5       frystyk  2601:        if test -n "$finalize_perm_rpath"; then
1.4       frystyk  2602:          # We should set the runpath_var.
                   2603:          rpath=
                   2604:          for dir in $finalize_perm_rpath; do
                   2605:            rpath="$rpath$dir:"
                   2606:          done
1.5       frystyk  2607:          finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
1.4       frystyk  2608:        fi
1.1       frystyk  2609:       fi
                   2610: 
1.3       frystyk  2611:       if test "$hardcode_action" = relink; then
1.5       frystyk  2612:        # Fast installation is not supported
                   2613:        link_command="$compile_var$compile_command$compile_rpath"
                   2614:        relink_command="$finalize_var$finalize_command$finalize_rpath"
                   2615:        
1.4       frystyk  2616:        $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
                   2617:        $echo "$modename: \`$output' will be relinked during installation" 1>&2
1.5       frystyk  2618:       else
                   2619:        if test "$fast_install" != no; then
                   2620:          link_command="$finalize_var$compile_command$finalize_rpath"
                   2621:          if test "$fast_install" = yes; then
                   2622:            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
                   2623:          else
                   2624:            # fast_install is set to needless
                   2625:            relink_command=
                   2626:          fi
                   2627:        else
                   2628:          link_command="$compile_var$compile_command$compile_rpath"
                   2629:          relink_command="$finalize_var$finalize_command$finalize_rpath"
                   2630:        fi
1.3       frystyk  2631:       fi
1.1       frystyk  2632: 
1.5       frystyk  2633:       # Replace the output file specification.
                   2634:       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
                   2635:       
                   2636:       # Delete the old output files.
                   2637:       $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
                   2638: 
                   2639:       $show "$link_command"
                   2640:       $run eval "$link_command" || exit $?
1.1       frystyk  2641: 
                   2642:       # Now create the wrapper script.
1.2       frystyk  2643:       $show "creating $output"
                   2644: 
1.5       frystyk  2645:       # Quote the relink command for shipping.
                   2646:       if test -n "$relink_command"; then
                   2647:        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
                   2648:       fi
1.2       frystyk  2649: 
                   2650:       # Quote $echo for shipping.
1.4       frystyk  2651:       if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
                   2652:        case "$0" in
1.5       frystyk  2653:        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
1.4       frystyk  2654:        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
                   2655:        esac
                   2656:        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
                   2657:       else
                   2658:        qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
                   2659:       fi
1.1       frystyk  2660: 
                   2661:       # Only actually do things if our run command is non-null.
                   2662:       if test -z "$run"; then
1.4       frystyk  2663:        # win32 will think the script is a binary if it has
                   2664:        # a .exe suffix, so we strip it off here.
                   2665:        case $output in
                   2666:          *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
                   2667:        esac
                   2668:        $rm $output
                   2669:        trap "$rm $output; exit 1" 1 2 15
1.1       frystyk  2670: 
1.4       frystyk  2671:        $echo > $output "\
1.3       frystyk  2672: #! $SHELL
1.1       frystyk  2673: 
1.4       frystyk  2674: # $output - temporary wrapper script for $objdir/$outputname
                   2675: # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
1.1       frystyk  2676: #
                   2677: # The $output program cannot be directly executed until all the libtool
                   2678: # libraries that it depends on are installed.
                   2679: #
1.4       frystyk  2680: # This wrapper script should never be moved out of the build directory.
1.1       frystyk  2681: # If it is, it will not operate correctly.
                   2682: 
1.2       frystyk  2683: # Sed substitution that helps us do robust quoting.  It backslashifies
                   2684: # metacharacters that are still active within double-quoted strings.
1.4       frystyk  2685: Xsed='sed -e 1s/^X//'
1.2       frystyk  2686: sed_quote_subst='$sed_quote_subst'
                   2687: 
                   2688: # The HP-UX ksh and POSIX shell print the target directory to stdout
                   2689: # if CDPATH is set.
                   2690: if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
                   2691: 
1.5       frystyk  2692: relink_command=\"$relink_command\"
                   2693: 
1.1       frystyk  2694: # This environment variable determines our operation mode.
1.2       frystyk  2695: if test \"\$libtool_install_magic\" = \"$magic\"; then
1.5       frystyk  2696:   # install mode needs the following variable:
1.1       frystyk  2697:   link_against_libtool_libs='$link_against_libtool_libs'
                   2698: else
1.2       frystyk  2699:   # When we are sourced in execute mode, \$file and \$echo are already set.
1.3       frystyk  2700:   if test \"\$libtool_execute_magic\" != \"$magic\"; then
1.2       frystyk  2701:     echo=\"$qecho\"
                   2702:     file=\"\$0\"
1.3       frystyk  2703:     # Make sure echo works.
                   2704:     if test \"X\$1\" = X--no-reexec; then
                   2705:       # Discard the --no-reexec flag, and continue.
                   2706:       shift
                   2707:     elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
                   2708:       # Yippee, \$echo works!
                   2709:       :
                   2710:     else
                   2711:       # Restart under the correct shell, and then maybe \$echo will work.
                   2712:       exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
                   2713:     fi
                   2714:   fi\
                   2715: "
1.4       frystyk  2716:        $echo >> $output "\
1.2       frystyk  2717: 
1.1       frystyk  2718:   # Find the directory that this script lives in.
1.2       frystyk  2719:   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
                   2720:   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
1.1       frystyk  2721: 
1.2       frystyk  2722:   # Follow symbolic links until we get to the real thisdir.
                   2723:   file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
                   2724:   while test -n \"\$file\"; do
                   2725:     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
                   2726: 
                   2727:     # If there was a directory component, then change thisdir.
                   2728:     if test \"x\$destdir\" != \"x\$file\"; then
                   2729:       case \"\$destdir\" in
1.5       frystyk  2730:       [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
1.2       frystyk  2731:       *) thisdir=\"\$thisdir/\$destdir\" ;;
                   2732:       esac
                   2733:     fi
1.1       frystyk  2734: 
1.2       frystyk  2735:     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
                   2736:     file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
                   2737:   done
1.1       frystyk  2738: 
1.2       frystyk  2739:   # Try to get the absolute directory name.
                   2740:   absdir=\`cd \"\$thisdir\" && pwd\`
                   2741:   test -n \"\$absdir\" && thisdir=\"\$absdir\"
1.5       frystyk  2742: "
1.1       frystyk  2743: 
1.5       frystyk  2744:        if test "$fast_install" = yes; then
                   2745:          echo >> $output "\
                   2746:   program=lt-'$outputname'
1.2       frystyk  2747:   progdir=\"\$thisdir/$objdir\"
1.5       frystyk  2748:   
                   2749:   if test ! -f \"\$progdir/\$program\" || \\
                   2750:      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
                   2751:        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
                   2752: 
                   2753:     file=\"\$\$-\$program\"
                   2754: 
                   2755:     if test ! -d \"\$progdir\"; then
                   2756:       $mkdir \"\$progdir\"
                   2757:     else
                   2758:       $rm \"\$progdir/\$file\"
                   2759:     fi"
                   2760: 
                   2761:          echo >> $output "\
                   2762: 
                   2763:     # relink executable if necessary
                   2764:     if test -n \"\$relink_command\"; then
                   2765:       if (cd \"\$thisdir\" && eval \$relink_command); then :
                   2766:       else
                   2767:        $rm \"\$progdir/\$file\"
                   2768:        exit 1
                   2769:       fi
                   2770:     fi
                   2771: 
                   2772:     $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
                   2773:     { $rm \"\$progdir/\$program\";
                   2774:       $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
                   2775:     $rm \"\$progdir/\$file\"
                   2776:   fi"
                   2777:        else
                   2778:          echo >> $output "\
1.4       frystyk  2779:   program='$outputname'
1.5       frystyk  2780:   progdir=\"\$thisdir/$objdir\"
                   2781: "
                   2782:        fi
                   2783: 
                   2784:        echo >> $output "\
1.1       frystyk  2785: 
1.2       frystyk  2786:   if test -f \"\$progdir/\$program\"; then"
1.1       frystyk  2787: 
1.4       frystyk  2788:        # Export our shlibpath_var if we have one.
1.5       frystyk  2789:        if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
1.4       frystyk  2790:          $echo >> $output "\
1.3       frystyk  2791:     # Add our own library path to $shlibpath_var
1.2       frystyk  2792:     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
1.1       frystyk  2793: 
                   2794:     # Some systems cannot cope with colon-terminated $shlibpath_var
1.4       frystyk  2795:     # The second colon is a workaround for a bug in BeOS R4 sed
                   2796:     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
1.1       frystyk  2797: 
                   2798:     export $shlibpath_var
1.2       frystyk  2799: "
1.4       frystyk  2800:        fi
                   2801: 
                   2802:        # fixup the dll searchpath if we need to.
                   2803:        if test -n "$dllsearchpath"; then
                   2804:          $echo >> $output "\
                   2805:     # Add the dll search path components to the executable PATH
                   2806:     PATH=$dllsearchpath:\$PATH
                   2807: "
                   2808:        fi
1.2       frystyk  2809: 
1.4       frystyk  2810:        $echo >> $output "\
1.3       frystyk  2811:     if test \"\$libtool_execute_magic\" != \"$magic\"; then
1.2       frystyk  2812:       # Run the actual program with our arguments.
1.4       frystyk  2813: "
                   2814:        case $host in
1.5       frystyk  2815:        *-*-cygwin* | *-*-mingw | *-*-os2*)
1.4       frystyk  2816:          # win32 systems need to use the prog path for dll
                   2817:          # lookup to work
                   2818:          $echo >> $output "\
                   2819:       exec \$progdir\\\\\$program \${1+\"\$@\"}
                   2820: "
                   2821:          ;;
                   2822:        *)
                   2823:          $echo >> $output "\
1.2       frystyk  2824:       # Export the path to the program.
                   2825:       PATH=\"\$progdir:\$PATH\"
                   2826:       export PATH
1.1       frystyk  2827: 
1.3       frystyk  2828:       exec \$program \${1+\"\$@\"}
1.4       frystyk  2829: "
                   2830:          ;;
                   2831:        esac
                   2832:        $echo >> $output "\
1.3       frystyk  2833:       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
1.2       frystyk  2834:       exit 1
                   2835:     fi
1.1       frystyk  2836:   else
                   2837:     # The program doesn't exist.
1.2       frystyk  2838:     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
                   2839:     \$echo \"This script is just a wrapper for \$program.\" 1>&2
                   2840:     echo \"See the $PACKAGE documentation for more information.\" 1>&2
1.1       frystyk  2841:     exit 1
                   2842:   fi
1.3       frystyk  2843: fi\
                   2844: "
1.4       frystyk  2845:        chmod +x $output
1.1       frystyk  2846:       fi
                   2847:       exit 0
                   2848:       ;;
                   2849:     esac
                   2850: 
                   2851:     # See if we need to build an old-fashioned archive.
1.3       frystyk  2852:     for oldlib in $oldlibs; do
                   2853: 
                   2854:       if test "$build_libtool_libs" = convenience; then
1.4       frystyk  2855:        oldobjs="$libobjs_save"
1.3       frystyk  2856:        addlibs="$convenience"
                   2857:        build_libtool_libs=no
                   2858:       else
1.4       frystyk  2859:        if test "$build_libtool_libs" = module; then
                   2860:          oldobjs="$libobjs_save"
                   2861:          build_libtool_libs=no
                   2862:        else
                   2863:          oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
                   2864:        fi
1.3       frystyk  2865:        addlibs="$old_convenience"
                   2866:       fi
                   2867: 
1.5       frystyk  2868:       if test -n "$addlibs"; then
                   2869:        gentop="$output_objdir/${outputname}x"
                   2870:        $show "${rm}r $gentop"
                   2871:        $run ${rm}r "$gentop"
                   2872:        $show "mkdir $gentop"
                   2873:        $run mkdir "$gentop"
1.3       frystyk  2874:        status=$?
1.5       frystyk  2875:        if test $status -ne 0 && test ! -d "$gentop"; then
1.3       frystyk  2876:          exit $status
                   2877:        fi
1.5       frystyk  2878:        generated="$generated $gentop"
                   2879:          
                   2880:        # Add in members from convenience archives.
                   2881:        for xlib in $addlibs; do
                   2882:          # Extract the objects.
                   2883:          case "$xlib" in
                   2884:          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
                   2885:          *) xabs=`pwd`"/$xlib" ;;
                   2886:          esac
                   2887:          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
                   2888:          xdir="$gentop/$xlib"
1.3       frystyk  2889: 
1.5       frystyk  2890:          $show "${rm}r $xdir"
                   2891:          $run ${rm}r "$xdir"
                   2892:          $show "mkdir $xdir"
                   2893:          $run mkdir "$xdir"
                   2894:          status=$?
                   2895:          if test $status -ne 0 && test ! -d "$xdir"; then
                   2896:            exit $status
                   2897:          fi
                   2898:          $show "(cd $xdir && $AR x $xabs)"
                   2899:          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
                   2900: 
                   2901:          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
                   2902:        done
                   2903:       fi
1.1       frystyk  2904: 
1.2       frystyk  2905:       # Do each command in the archive commands.
                   2906:       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
1.3       frystyk  2907:        eval cmds=\"$old_archive_from_new_cmds\"
1.1       frystyk  2908:       else
1.5       frystyk  2909:        # Ensure that we have .o objects in place incase we decided
                   2910:        # not to build a shared library, and have fallen back to building
                   2911:        # static libs even though --disable-static was passed!
                   2912:        for oldobj in $oldobjs; do
                   2913:          if test ! -f $oldobj; then
                   2914:            obj=`$echo "X$oldobj" | $Xsed -e "$o2lo"`
                   2915:            $show "${LN_S} $obj $oldobj"
                   2916:            $run ${LN_S} $obj $oldobj || exit $?
                   2917:          fi
                   2918:        done
                   2919: 
1.3       frystyk  2920:        eval cmds=\"$old_archive_cmds\"
1.1       frystyk  2921:       fi
1.4       frystyk  2922:       IFS="${IFS=      }"; save_ifs="$IFS"; IFS='~'
1.1       frystyk  2923:       for cmd in $cmds; do
1.4       frystyk  2924:        IFS="$save_ifs"
                   2925:        $show "$cmd"
                   2926:        $run eval "$cmd" || exit $?
1.1       frystyk  2927:       done
                   2928:       IFS="$save_ifs"
1.3       frystyk  2929:     done
                   2930: 
                   2931:     if test -n "$generated"; then
                   2932:       $show "${rm}r$generated"
                   2933:       $run ${rm}r$generated
1.1       frystyk  2934:     fi
                   2935: 
                   2936:     # Now create the libtool archive.
                   2937:     case "$output" in
                   2938:     *.la)
                   2939:       old_library=
1.4       frystyk  2940:       test "$build_old_libs" = yes && old_library="$libname.$libext"
1.2       frystyk  2941:       $show "creating $output"
1.1       frystyk  2942: 
1.5       frystyk  2943:       if test -n "$xrpath"; then
                   2944:        temp_xrpath=
                   2945:        for libdir in $xrpath; do
                   2946:          temp_xrpath="$temp_xrpath -R$libdir"
                   2947:        done
                   2948:        dependency_libs="$temp_xrpath $dependency_libs"
                   2949:       fi
                   2950: 
1.1       frystyk  2951:       # Only create the output if not a dry run.
                   2952:       if test -z "$run"; then
1.5       frystyk  2953:        for installed in no yes; do
                   2954:          if test "$installed" = yes; then
                   2955:            if test -z "$install_libdir"; then
                   2956:              break
                   2957:            fi
                   2958:            output="$output_objdir/$outputname"i
                   2959:          fi
                   2960:          $rm $output
                   2961:          $echo > $output "\
                   2962: # $outputname - a libtool library file
1.4       frystyk  2963: # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
1.5       frystyk  2964: #
                   2965: # Please DO NOT delete this file!
                   2966: # It is necessary for linking the library.
1.1       frystyk  2967: 
                   2968: # The name that we can dlopen(3).
                   2969: dlname='$dlname'
                   2970: 
                   2971: # Names of this library.
                   2972: library_names='$library_names'
                   2973: 
                   2974: # The name of the static archive.
                   2975: old_library='$old_library'
                   2976: 
1.2       frystyk  2977: # Libraries that this one depends upon.
                   2978: dependency_libs='$dependency_libs'
                   2979: 
1.1       frystyk  2980: # Version information for $libname.
                   2981: current=$current
                   2982: age=$age
                   2983: revision=$revision
                   2984: 
1.4       frystyk  2985: # Is this an already installed library?
1.5       frystyk  2986: installed=$installed
1.4       frystyk  2987: 
1.1       frystyk  2988: # Directory that this library needs to be installed in:
1.3       frystyk  2989: libdir='$install_libdir'\
                   2990: "
1.5       frystyk  2991:        done
1.1       frystyk  2992:       fi
                   2993: 
                   2994:       # Do a symbolic link so that the libtool archive can be found in
                   2995:       # LD_LIBRARY_PATH before the program is installed.
1.4       frystyk  2996:       $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
                   2997:       $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
1.1       frystyk  2998:       ;;
                   2999:     esac
                   3000:     exit 0
                   3001:     ;;
                   3002: 
                   3003:   # libtool install mode
                   3004:   install)
1.2       frystyk  3005:     modename="$modename: install"
                   3006: 
1.3       frystyk  3007:     # There may be an optional sh(1) argument at the beginning of
1.2       frystyk  3008:     # install_prog (especially on Windows NT).
1.4       frystyk  3009:     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
1.2       frystyk  3010:       # Aesthetically quote it.
                   3011:       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
                   3012:       case "$arg" in
                   3013:       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
                   3014:        arg="\"$arg\""
                   3015:        ;;
                   3016:       esac
                   3017:       install_prog="$arg "
                   3018:       arg="$1"
                   3019:       shift
                   3020:     else
                   3021:       install_prog=
                   3022:       arg="$nonopt"
                   3023:     fi
1.1       frystyk  3024: 
1.2       frystyk  3025:     # The real first argument should be the name of the installation program.
                   3026:     # Aesthetically quote it.
                   3027:     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
                   3028:     case "$arg" in
                   3029:     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \      ]*|*]*)
                   3030:       arg="\"$arg\""
                   3031:       ;;
                   3032:     esac
                   3033:     install_prog="$install_prog$arg"
1.1       frystyk  3034: 
                   3035:     # We need to accept at least all the BSD install flags.
                   3036:     dest=
                   3037:     files=
                   3038:     opts=
                   3039:     prev=
                   3040:     install_type=
1.3       frystyk  3041:     isdir=no
1.1       frystyk  3042:     stripme=
                   3043:     for arg
                   3044:     do
                   3045:       if test -n "$dest"; then
1.4       frystyk  3046:        files="$files $dest"
                   3047:        dest="$arg"
                   3048:        continue
1.1       frystyk  3049:       fi
                   3050: 
                   3051:       case "$arg" in
                   3052:       -d) isdir=yes ;;
                   3053:       -f) prev="-f" ;;
                   3054:       -g) prev="-g" ;;
                   3055:       -m) prev="-m" ;;
                   3056:       -o) prev="-o" ;;
                   3057:       -s)
1.4       frystyk  3058:        stripme=" -s"
                   3059:        continue
                   3060:        ;;
1.1       frystyk  3061:       -*) ;;
                   3062: 
                   3063:       *)
1.4       frystyk  3064:        # If the previous option needed an argument, then skip it.
                   3065:        if test -n "$prev"; then
                   3066:          prev=
                   3067:        else
                   3068:          dest="$arg"
                   3069:          continue
                   3070:        fi
                   3071:        ;;
1.1       frystyk  3072:       esac
1.2       frystyk  3073: 
                   3074:       # Aesthetically quote the argument.
                   3075:       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
                   3076:       case "$arg" in
                   3077:       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
                   3078:        arg="\"$arg\""
                   3079:        ;;
                   3080:       esac
1.1       frystyk  3081:       install_prog="$install_prog $arg"
                   3082:     done
                   3083: 
                   3084:     if test -z "$install_prog"; then
1.2       frystyk  3085:       $echo "$modename: you must specify an install program" 1>&2
                   3086:       $echo "$help" 1>&2
1.1       frystyk  3087:       exit 1
                   3088:     fi
                   3089: 
                   3090:     if test -n "$prev"; then
1.2       frystyk  3091:       $echo "$modename: the \`$prev' option requires an argument" 1>&2
                   3092:       $echo "$help" 1>&2
1.1       frystyk  3093:       exit 1
                   3094:     fi
                   3095: 
                   3096:     if test -z "$files"; then
                   3097:       if test -z "$dest"; then
1.4       frystyk  3098:        $echo "$modename: no file or destination specified" 1>&2
1.1       frystyk  3099:       else
1.4       frystyk  3100:        $echo "$modename: you must specify a destination" 1>&2
1.1       frystyk  3101:       fi
1.2       frystyk  3102:       $echo "$help" 1>&2
1.1       frystyk  3103:       exit 1
                   3104:     fi
                   3105: 
                   3106:     # Strip any trailing slash from the destination.
1.2       frystyk  3107:     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
1.1       frystyk  3108: 
                   3109:     # Check to see that the destination is a directory.
                   3110:     test -d "$dest" && isdir=yes
1.3       frystyk  3111:     if test "$isdir" = yes; then
1.1       frystyk  3112:       destdir="$dest"
                   3113:       destname=
                   3114:     else
1.2       frystyk  3115:       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
                   3116:       test "X$destdir" = "X$dest" && destdir=.
                   3117:       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
1.1       frystyk  3118: 
                   3119:       # Not a directory, so check to see that there is only one file specified.
                   3120:       set dummy $files
                   3121:       if test $# -gt 2; then
1.4       frystyk  3122:        $echo "$modename: \`$dest' is not a directory" 1>&2
                   3123:        $echo "$help" 1>&2
                   3124:        exit 1
1.1       frystyk  3125:       fi
                   3126:     fi
                   3127:     case "$destdir" in
1.5       frystyk  3128:     [\\/]* | [A-Za-z]:[\\/]*) ;;
1.1       frystyk  3129:     *)
                   3130:       for file in $files; do
1.4       frystyk  3131:        case "$file" in
                   3132:        *.lo) ;;
                   3133:        *)
                   3134:          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
                   3135:          $echo "$help" 1>&2
                   3136:          exit 1
                   3137:          ;;
                   3138:        esac
1.1       frystyk  3139:       done
                   3140:       ;;
                   3141:     esac
                   3142: 
1.2       frystyk  3143:     # This variable tells wrapper scripts just to set variables rather
                   3144:     # than running their programs.
                   3145:     libtool_install_magic="$magic"
                   3146: 
1.1       frystyk  3147:     staticlibs=
                   3148:     future_libdirs=
                   3149:     current_libdirs=
                   3150:     for file in $files; do
                   3151: 
                   3152:       # Do each installation.
                   3153:       case "$file" in
1.4       frystyk  3154:       *.a | *.lib)
                   3155:        # Do the static libraries later.
                   3156:        staticlibs="$staticlibs $file"
                   3157:        ;;
1.1       frystyk  3158: 
                   3159:       *.la)
1.4       frystyk  3160:        # Check to see that this really is a libtool archive.
                   3161:        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
                   3162:        else
                   3163:          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
                   3164:          $echo "$help" 1>&2
                   3165:          exit 1
                   3166:        fi
                   3167: 
                   3168:        library_names=
                   3169:        old_library=
                   3170:        # If there is no directory component, then add one.
                   3171:        case "$file" in
                   3172:        */* | *\\*) . $file ;;
                   3173:        *) . ./$file ;;
                   3174:        esac
                   3175: 
                   3176:        # Add the libdir to current_libdirs if it is the destination.
                   3177:        if test "X$destdir" = "X$libdir"; then
                   3178:          case "$current_libdirs " in
                   3179:          *" $libdir "*) ;;
                   3180:          *) current_libdirs="$current_libdirs $libdir" ;;
                   3181:          esac
                   3182:        else
                   3183:          # Note the libdir as a future libdir.
                   3184:          case "$future_libdirs " in
                   3185:          *" $libdir "*) ;;
                   3186:          *) future_libdirs="$future_libdirs $libdir" ;;
                   3187:          esac
                   3188:        fi
                   3189: 
                   3190:        dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
                   3191:        test "X$dir" = "X$file/" && dir=
                   3192:        dir="$dir$objdir"
                   3193: 
                   3194:        # See the names of the shared library.
                   3195:        set dummy $library_names
                   3196:        if test -n "$2"; then
                   3197:          realname="$2"
                   3198:          shift
                   3199:          shift
                   3200: 
                   3201:          # Install the shared library and build the symlinks.
                   3202:          $show "$install_prog $dir/$realname $destdir/$realname"
                   3203:          $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
                   3204:          test "X$dlname" = "X$realname" && dlname=
                   3205: 
                   3206:          if test $# -gt 0; then
                   3207:            # Delete the old symlinks, and create new ones.
                   3208:            for linkname
                   3209:            do
                   3210:              test "X$dlname" = "X$linkname" && dlname=
                   3211:              if test "$linkname" != "$realname"; then
                   3212:                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
                   3213:                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
                   3214:              fi
                   3215:            done
                   3216:          fi
                   3217: 
                   3218:          if test -n "$dlname"; then
                   3219:            # Install the dynamically-loadable library.
                   3220:            $show "$install_prog $dir/$dlname $destdir/$dlname"
                   3221:            $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
                   3222:          fi
                   3223: 
                   3224:          # Do each command in the postinstall commands.
                   3225:          lib="$destdir/$realname"
                   3226:          eval cmds=\"$postinstall_cmds\"
                   3227:          IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
                   3228:          for cmd in $cmds; do
                   3229:            IFS="$save_ifs"
                   3230:            $show "$cmd"
                   3231:            $run eval "$cmd" || exit $?
                   3232:          done
                   3233:          IFS="$save_ifs"
                   3234:        fi
                   3235: 
                   3236:        # Install the pseudo-library for information purposes.
                   3237:        name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
                   3238:        instname="$dir/$name"i
                   3239:        $show "$install_prog $instname $destdir/$name"
                   3240:        $run eval "$install_prog $instname $destdir/$name" || exit $?
                   3241: 
                   3242:        # Maybe install the static library, too.
                   3243:        test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
                   3244:        ;;
1.1       frystyk  3245: 
                   3246:       *.lo)
1.4       frystyk  3247:        # Install (i.e. copy) a libtool object.
                   3248: 
                   3249:        # Figure out destination file name, if it wasn't already specified.
                   3250:        if test -n "$destname"; then
                   3251:          destfile="$destdir/$destname"
                   3252:        else
                   3253:          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
                   3254:          destfile="$destdir/$destfile"
                   3255:        fi
                   3256: 
                   3257:        # Deduce the name of the destination old-style object file.
                   3258:        case "$destfile" in
                   3259:        *.lo)
                   3260:          staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
                   3261:          ;;
                   3262:        *.o | *.obj)
                   3263:          staticdest="$destfile"
                   3264:          destfile=
                   3265:          ;;
                   3266:        *)
                   3267:          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
                   3268:          $echo "$help" 1>&2
                   3269:          exit 1
                   3270:          ;;
                   3271:        esac
                   3272: 
                   3273:        # Install the libtool object if requested.
                   3274:        if test -n "$destfile"; then
                   3275:          $show "$install_prog $file $destfile"
                   3276:          $run eval "$install_prog $file $destfile" || exit $?
                   3277:        fi
1.1       frystyk  3278: 
1.4       frystyk  3279:        # Install the old object if enabled.
                   3280:        if test "$build_old_libs" = yes; then
                   3281:          # Deduce the name of the old-style object file.
                   3282:          staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
                   3283: 
                   3284:          $show "$install_prog $staticobj $staticdest"
                   3285:          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
                   3286:        fi
                   3287:        exit 0
                   3288:        ;;
1.1       frystyk  3289: 
                   3290:       *)
1.4       frystyk  3291:        # Figure out destination file name, if it wasn't already specified.
                   3292:        if test -n "$destname"; then
                   3293:          destfile="$destdir/$destname"
                   3294:        else
                   3295:          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
                   3296:          destfile="$destdir/$destfile"
                   3297:        fi
                   3298: 
                   3299:        # Do a test to see if this is really a libtool program.
                   3300:        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
                   3301:          link_against_libtool_libs=
1.5       frystyk  3302:          relink_command=
1.4       frystyk  3303: 
                   3304:          # If there is no directory component, then add one.
                   3305:          case "$file" in
                   3306:          */* | *\\*) . $file ;;
                   3307:          *) . ./$file ;;
                   3308:          esac
                   3309: 
                   3310:          # Check the variables that should have been set.
1.5       frystyk  3311:          if test -z "$link_against_libtool_libs"; then
1.4       frystyk  3312:            $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
                   3313:            exit 1
                   3314:          fi
                   3315: 
                   3316:          finalize=yes
                   3317:          for lib in $link_against_libtool_libs; do
                   3318:            # Check to see that each library is installed.
                   3319:            libdir=
                   3320:            if test -f "$lib"; then
                   3321:              # If there is no directory component, then add one.
                   3322:              case "$lib" in
                   3323:              */* | *\\*) . $lib ;;
                   3324:              *) . ./$lib ;;
                   3325:              esac
                   3326:            fi
                   3327:            libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
                   3328:            if test -n "$libdir" && test ! -f "$libfile"; then
                   3329:              $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
                   3330:              finalize=no
                   3331:            fi
                   3332:          done
                   3333: 
1.5       frystyk  3334:          outputname=
                   3335:          if test "$fast_install" = no && test -n "$relink_command"; then
                   3336:            if test "$finalize" = yes && test -z "$run"; then
                   3337:              tmpdir="/tmp"
                   3338:              test -n "$TMPDIR" && tmpdir="$TMPDIR"
                   3339:              tmpdir="$tmpdir/libtool-$$"
                   3340:              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
                   3341:              else
                   3342:                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
                   3343:                continue
                   3344:              fi
                   3345:              outputname="$tmpdir/$file"
                   3346:              # Replace the output file specification.
                   3347:              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
                   3348: 
                   3349:              $show "$relink_command"
                   3350:              if $run eval "$relink_command"; then :
1.4       frystyk  3351:              else
                   3352:                $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
1.5       frystyk  3353:                ${rm}r "$tmpdir"
1.4       frystyk  3354:                continue
                   3355:              fi
1.5       frystyk  3356:              file="$outputname"
1.4       frystyk  3357:            else
1.5       frystyk  3358:              $echo "$modename: warning: cannot relink \`$file'" 1>&2
1.4       frystyk  3359:            fi
                   3360:          else
                   3361:            # Install the binary that we compiled earlier.
1.2       frystyk  3362:            file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
1.4       frystyk  3363:          fi
                   3364:        fi
1.1       frystyk  3365: 
1.4       frystyk  3366:        $show "$install_prog$stripme $file $destfile"
                   3367:        $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
1.5       frystyk  3368:        test -n "$outputname" && ${rm}r "$tmpdir"
1.4       frystyk  3369:        ;;
1.1       frystyk  3370:       esac
                   3371:     done
                   3372: 
                   3373:     for file in $staticlibs; do
1.2       frystyk  3374:       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
1.1       frystyk  3375: 
                   3376:       # Set up the ranlib parameters.
                   3377:       oldlib="$destdir/$name"
                   3378: 
                   3379:       $show "$install_prog $file $oldlib"
1.2       frystyk  3380:       $run eval "$install_prog \$file \$oldlib" || exit $?
1.1       frystyk  3381: 
                   3382:       # Do each command in the postinstall commands.
1.3       frystyk  3383:       eval cmds=\"$old_postinstall_cmds\"
1.4       frystyk  3384:       IFS="${IFS=      }"; save_ifs="$IFS"; IFS='~'
1.1       frystyk  3385:       for cmd in $cmds; do
1.4       frystyk  3386:        IFS="$save_ifs"
                   3387:        $show "$cmd"
                   3388:        $run eval "$cmd" || exit $?
1.1       frystyk  3389:       done
                   3390:       IFS="$save_ifs"
                   3391:     done
                   3392: 
                   3393:     if test -n "$future_libdirs"; then
1.2       frystyk  3394:       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
1.1       frystyk  3395:     fi
                   3396: 
                   3397:     if test -n "$current_libdirs"; then
                   3398:       # Maybe just do a dry run.
                   3399:       test -n "$run" && current_libdirs=" -n$current_libdirs"
1.2       frystyk  3400:       exec $SHELL $0 --finish$current_libdirs
1.1       frystyk  3401:       exit 1
                   3402:     fi
                   3403: 
                   3404:     exit 0
                   3405:     ;;
                   3406: 
1.2       frystyk  3407:   # libtool finish mode
                   3408:   finish)
                   3409:     modename="$modename: finish"
                   3410:     libdirs="$nonopt"
1.3       frystyk  3411:     admincmds=
1.2       frystyk  3412: 
                   3413:     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
                   3414:       for dir
                   3415:       do
1.4       frystyk  3416:        libdirs="$libdirs $dir"
1.2       frystyk  3417:       done
                   3418: 
                   3419:       for libdir in $libdirs; do
                   3420:        if test -n "$finish_cmds"; then
                   3421:          # Do each command in the finish commands.
1.3       frystyk  3422:          eval cmds=\"$finish_cmds\"
1.4       frystyk  3423:          IFS="${IFS=   }"; save_ifs="$IFS"; IFS='~'
                   3424:          for cmd in $cmds; do
                   3425:            IFS="$save_ifs"
                   3426:            $show "$cmd"
                   3427:            $run eval "$cmd" || admincmds="$admincmds
1.3       frystyk  3428:        $cmd"
1.4       frystyk  3429:          done
                   3430:          IFS="$save_ifs"
1.2       frystyk  3431:        fi
                   3432:        if test -n "$finish_eval"; then
                   3433:          # Do the single finish_eval.
1.3       frystyk  3434:          eval cmds=\"$finish_eval\"
                   3435:          $run eval "$cmds" || admincmds="$admincmds
                   3436:        $cmds"
1.2       frystyk  3437:        fi
                   3438:       done
                   3439:     fi
                   3440: 
1.4       frystyk  3441:     # Exit here if they wanted silent mode.
                   3442:     test "$show" = : && exit 0
                   3443: 
1.3       frystyk  3444:     echo "----------------------------------------------------------------------"
1.2       frystyk  3445:     echo "Libraries have been installed in:"
                   3446:     for libdir in $libdirs; do
                   3447:       echo "   $libdir"
1.1       frystyk  3448:     done
1.2       frystyk  3449:     echo
1.4       frystyk  3450:     echo "If you ever happen to want to link against installed libraries"
                   3451:     echo "in a given directory, LIBDIR, you must either use libtool, and"
                   3452:     echo "specify the full pathname of the library, or use \`-LLIBDIR'"
                   3453:     echo "flag during linking and do at least one of the following:"
1.2       frystyk  3454:     if test -n "$shlibpath_var"; then
                   3455:       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
                   3456:       echo "     during execution"
                   3457:     fi
                   3458:     if test -n "$runpath_var"; then
                   3459:       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
                   3460:       echo "     during linking"
                   3461:     fi
                   3462:     if test -n "$hardcode_libdir_flag_spec"; then
                   3463:       libdir=LIBDIR
1.3       frystyk  3464:       eval flag=\"$hardcode_libdir_flag_spec\"
1.1       frystyk  3465: 
1.2       frystyk  3466:       echo "   - use the \`$flag' linker flag"
                   3467:     fi
1.3       frystyk  3468:     if test -n "$admincmds"; then
                   3469:       echo "   - have your system administrator run these commands:$admincmds"
                   3470:     fi
1.2       frystyk  3471:     if test -f /etc/ld.so.conf; then
                   3472:       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
                   3473:     fi
                   3474:     echo
                   3475:     echo "See any operating system documentation about shared libraries for"
                   3476:     echo "more information, such as the ld(1) and ld.so(8) manual pages."
1.3       frystyk  3477:     echo "----------------------------------------------------------------------"
1.2       frystyk  3478:     exit 0
                   3479:     ;;
                   3480: 
                   3481:   # libtool execute mode
                   3482:   execute)
                   3483:     modename="$modename: execute"
                   3484: 
                   3485:     # The first argument is the command name.
                   3486:     cmd="$nonopt"
                   3487:     if test -z "$cmd"; then
                   3488:       $echo "$modename: you must specify a COMMAND" 1>&2
                   3489:       $echo "$help"
1.1       frystyk  3490:       exit 1
                   3491:     fi
                   3492: 
1.2       frystyk  3493:     # Handle -dlopen flags immediately.
                   3494:     for file in $execute_dlfiles; do
1.3       frystyk  3495:       if test ! -f "$file"; then
1.2       frystyk  3496:        $echo "$modename: \`$file' is not a file" 1>&2
                   3497:        $echo "$help" 1>&2
                   3498:        exit 1
1.1       frystyk  3499:       fi
                   3500: 
1.2       frystyk  3501:       dir=
                   3502:       case "$file" in
                   3503:       *.la)
1.4       frystyk  3504:        # Check to see that this really is a libtool archive.
                   3505:        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
                   3506:        else
                   3507:          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
                   3508:          $echo "$help" 1>&2
                   3509:          exit 1
                   3510:        fi
1.2       frystyk  3511: 
                   3512:        # Read the libtool library.
                   3513:        dlname=
                   3514:        library_names=
                   3515: 
1.4       frystyk  3516:        # If there is no directory component, then add one.
1.2       frystyk  3517:        case "$file" in
                   3518:        */* | *\\*) . $file ;;
1.4       frystyk  3519:        *) . ./$file ;;
1.2       frystyk  3520:        esac
                   3521: 
                   3522:        # Skip this library if it cannot be dlopened.
                   3523:        if test -z "$dlname"; then
                   3524:          # Warn if it was a shared library.
                   3525:          test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
                   3526:          continue
                   3527:        fi
                   3528: 
                   3529:        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
                   3530:        test "X$dir" = "X$file" && dir=.
                   3531: 
                   3532:        if test -f "$dir/$objdir/$dlname"; then
                   3533:          dir="$dir/$objdir"
                   3534:        else
                   3535:          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
                   3536:          exit 1
                   3537:        fi
                   3538:        ;;
                   3539: 
                   3540:       *.lo)
                   3541:        # Just add the directory containing the .lo file.
                   3542:        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
                   3543:        test "X$dir" = "X$file" && dir=.
                   3544:        ;;
                   3545: 
                   3546:       *)
                   3547:        $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
1.4       frystyk  3548:        continue
1.2       frystyk  3549:        ;;
1.1       frystyk  3550:       esac
                   3551: 
1.2       frystyk  3552:       # Get the absolute pathname.
                   3553:       absdir=`cd "$dir" && pwd`
                   3554:       test -n "$absdir" && dir="$absdir"
                   3555: 
                   3556:       # Now add the directory to shlibpath_var.
                   3557:       if eval "test -z \"\$$shlibpath_var\""; then
                   3558:        eval "$shlibpath_var=\"\$dir\""
1.1       frystyk  3559:       else
1.2       frystyk  3560:        eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1.1       frystyk  3561:       fi
                   3562:     done
                   3563: 
1.2       frystyk  3564:     # This variable tells wrapper scripts just to set shlibpath_var
                   3565:     # rather than running their programs.
                   3566:     libtool_execute_magic="$magic"
                   3567: 
                   3568:     # Check if any of the arguments is a wrapper script.
                   3569:     args=
                   3570:     for file
                   3571:     do
                   3572:       case "$file" in
                   3573:       -*) ;;
                   3574:       *)
1.4       frystyk  3575:        # Do a test to see if this is really a libtool program.
                   3576:        if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1.2       frystyk  3577:          # If there is no directory component, then add one.
                   3578:          case "$file" in
                   3579:          */* | *\\*) . $file ;;
                   3580:          *) . ./$file ;;
                   3581:          esac
                   3582: 
                   3583:          # Transform arg to wrapped name.
                   3584:          file="$progdir/$program"
                   3585:        fi
1.4       frystyk  3586:        ;;
1.2       frystyk  3587:       esac
                   3588:       # Quote arguments (to preserve shell metacharacters).
                   3589:       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
                   3590:       args="$args \"$file\""
                   3591:     done
1.1       frystyk  3592: 
1.2       frystyk  3593:     if test -z "$run"; then
                   3594:       # Export the shlibpath_var.
                   3595:       eval "export $shlibpath_var"
1.1       frystyk  3596: 
1.3       frystyk  3597:       # Restore saved enviroment variables
                   3598:       if test "${save_LC_ALL+set}" = set; then
1.4       frystyk  3599:        LC_ALL="$save_LC_ALL"; export LC_ALL
1.3       frystyk  3600:       fi
                   3601:       if test "${save_LANG+set}" = set; then
1.4       frystyk  3602:        LANG="$save_LANG"; export LANG
1.3       frystyk  3603:       fi
                   3604: 
1.2       frystyk  3605:       # Now actually exec the command.
                   3606:       eval "exec \$cmd$args"
1.1       frystyk  3607: 
1.2       frystyk  3608:       $echo "$modename: cannot exec \$cmd$args"
                   3609:       exit 1
                   3610:     else
                   3611:       # Display what would be done.
                   3612:       eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
                   3613:       $echo "export $shlibpath_var"
                   3614:       $echo "$cmd$args"
                   3615:       exit 0
1.1       frystyk  3616:     fi
                   3617:     ;;
                   3618: 
                   3619:   # libtool uninstall mode
                   3620:   uninstall)
1.2       frystyk  3621:     modename="$modename: uninstall"
1.1       frystyk  3622:     rm="$nonopt"
                   3623:     files=
                   3624: 
                   3625:     for arg
                   3626:     do
                   3627:       case "$arg" in
                   3628:       -*) rm="$rm $arg" ;;
                   3629:       *) files="$files $arg" ;;
                   3630:       esac
                   3631:     done
                   3632: 
                   3633:     if test -z "$rm"; then
1.2       frystyk  3634:       $echo "$modename: you must specify an RM program" 1>&2
                   3635:       $echo "$help" 1>&2
1.1       frystyk  3636:       exit 1
                   3637:     fi
                   3638: 
                   3639:     for file in $files; do
1.2       frystyk  3640:       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
                   3641:       test "X$dir" = "X$file" && dir=.
                   3642:       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
1.1       frystyk  3643: 
                   3644:       rmfiles="$file"
                   3645: 
                   3646:       case "$name" in
                   3647:       *.la)
1.4       frystyk  3648:        # Possibly a libtool archive, so verify it.
                   3649:        if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
                   3650:          . $dir/$name
                   3651: 
                   3652:          # Delete the libtool libraries and symlinks.
                   3653:          for n in $library_names; do
                   3654:            rmfiles="$rmfiles $dir/$n"
                   3655:            test "X$n" = "X$dlname" && dlname=
                   3656:          done
                   3657:          test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
                   3658:          test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
1.2       frystyk  3659: 
                   3660:          $show "$rm $rmfiles"
                   3661:          $run $rm $rmfiles
                   3662: 
                   3663:          if test -n "$library_names"; then
                   3664:            # Do each command in the postuninstall commands.
1.3       frystyk  3665:            eval cmds=\"$postuninstall_cmds\"
1.4       frystyk  3666:            IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
1.2       frystyk  3667:            for cmd in $cmds; do
                   3668:              IFS="$save_ifs"
                   3669:              $show "$cmd"
                   3670:              $run eval "$cmd"
                   3671:            done
                   3672:            IFS="$save_ifs"
                   3673:          fi
                   3674: 
1.4       frystyk  3675:          if test -n "$old_library"; then
1.2       frystyk  3676:            # Do each command in the old_postuninstall commands.
1.3       frystyk  3677:            eval cmds=\"$old_postuninstall_cmds\"
1.4       frystyk  3678:            IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
1.2       frystyk  3679:            for cmd in $cmds; do
                   3680:              IFS="$save_ifs"
                   3681:              $show "$cmd"
                   3682:              $run eval "$cmd"
                   3683:            done
                   3684:            IFS="$save_ifs"
                   3685:          fi
1.1       frystyk  3686: 
1.4       frystyk  3687:          # FIXME: should reinstall the best remaining shared library.
                   3688:        fi
                   3689:        ;;
1.1       frystyk  3690: 
                   3691:       *.lo)
1.4       frystyk  3692:        if test "$build_old_libs" = yes; then
                   3693:          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
                   3694:          rmfiles="$rmfiles $dir/$oldobj"
                   3695:        fi
1.2       frystyk  3696:        $show "$rm $rmfiles"
                   3697:        $run $rm $rmfiles
1.4       frystyk  3698:        ;;
1.2       frystyk  3699: 
                   3700:       *)
1.4       frystyk  3701:        $show "$rm $rmfiles"
1.2       frystyk  3702:        $run $rm $rmfiles
                   3703:        ;;
1.1       frystyk  3704:       esac
                   3705:     done
                   3706:     exit 0
                   3707:     ;;
                   3708: 
1.2       frystyk  3709:   "")
                   3710:     $echo "$modename: you must specify a MODE" 1>&2
                   3711:     $echo "$generic_help" 1>&2
1.1       frystyk  3712:     exit 1
                   3713:     ;;
                   3714:   esac
                   3715: 
1.2       frystyk  3716:   $echo "$modename: invalid operation mode \`$mode'" 1>&2
                   3717:   $echo "$generic_help" 1>&2
1.1       frystyk  3718:   exit 1
                   3719: fi # test -z "$show_help"
                   3720: 
                   3721: # We need to display help for each of the modes.
                   3722: case "$mode" in
1.2       frystyk  3723: "") $echo \
                   3724: "Usage: $modename [OPTION]... [MODE-ARG]...
1.1       frystyk  3725: 
                   3726: Provide generalized library-building support services.
                   3727: 
1.3       frystyk  3728:     --config          show all configuration variables
                   3729:     --debug           enable verbose shell tracing
1.1       frystyk  3730: -n, --dry-run         display commands without modifying any files
1.3       frystyk  3731:     --features        display basic configuration information and exit
1.1       frystyk  3732:     --finish          same as \`--mode=finish'
                   3733:     --help            display this help message and exit
                   3734:     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
1.2       frystyk  3735:     --quiet           same as \`--silent'
                   3736:     --silent          don't print informational messages
1.1       frystyk  3737:     --version         print version information
                   3738: 
                   3739: MODE must be one of the following:
                   3740: 
                   3741:       compile         compile a source file into a libtool object
1.2       frystyk  3742:       execute         automatically set library path, then run a program
1.1       frystyk  3743:       finish          complete the installation of libtool libraries
                   3744:       install         install libraries or executables
                   3745:       link            create a library or an executable
                   3746:       uninstall       remove libraries from an installed directory
                   3747: 
1.2       frystyk  3748: MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
                   3749: a more detailed description of MODE."
                   3750:   exit 0
1.1       frystyk  3751:   ;;
                   3752: 
                   3753: compile)
1.2       frystyk  3754:   $echo \
                   3755: "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1.1       frystyk  3756: 
                   3757: Compile a source file into a libtool library object.
1.3       frystyk  3758: 
                   3759: This mode accepts the following additional options:
                   3760: 
1.4       frystyk  3761:   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
1.3       frystyk  3762:   -static           always build a \`.o' file suitable for static linking
1.1       frystyk  3763: 
                   3764: COMPILE-COMMAND is a command to be used in creating a \`standard' object file
                   3765: from the given SOURCEFILE.
                   3766: 
                   3767: The output file name is determined by removing the directory component from
                   3768: SOURCEFILE, then substituting the C source code suffix \`.c' with the
1.2       frystyk  3769: library object suffix, \`.lo'."
1.1       frystyk  3770:   ;;
                   3771: 
1.2       frystyk  3772: execute)
                   3773:   $echo \
                   3774: "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
                   3775: 
                   3776: Automatically set library path, then run a program.
                   3777: 
                   3778: This mode accepts the following additional options:
1.1       frystyk  3779: 
1.2       frystyk  3780:   -dlopen FILE      add the directory containing FILE to the library path
1.1       frystyk  3781: 
1.2       frystyk  3782: This mode sets the library path environment variable according to \`-dlopen'
                   3783: flags.
1.1       frystyk  3784: 
1.2       frystyk  3785: If any of the ARGS are libtool executable wrappers, then they are translated
                   3786: into their corresponding uninstalled binary, and any of their required library
                   3787: directories are added to the library path.
                   3788: 
                   3789: Then, COMMAND is executed, with ARGS as arguments."
1.1       frystyk  3790:   ;;
                   3791: 
                   3792: finish)
1.2       frystyk  3793:   $echo \
                   3794: "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
1.1       frystyk  3795: 
                   3796: Complete the installation of libtool libraries.
                   3797: 
                   3798: Each LIBDIR is a directory that contains libtool libraries.
                   3799: 
                   3800: The commands that this mode executes may require superuser privileges.  Use
1.2       frystyk  3801: the \`--dry-run' option if you just want to see what would be executed."
1.1       frystyk  3802:   ;;
                   3803: 
                   3804: install)
1.2       frystyk  3805:   $echo \
                   3806: "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
1.1       frystyk  3807: 
                   3808: Install executables or libraries.
                   3809: 
                   3810: INSTALL-COMMAND is the installation command.  The first component should be
                   3811: either the \`install' or \`cp' program.
                   3812: 
                   3813: The rest of the components are interpreted as arguments to that command (only
1.2       frystyk  3814: BSD-compatible install options are recognized)."
1.1       frystyk  3815:   ;;
                   3816: 
                   3817: link)
1.2       frystyk  3818:   $echo \
                   3819: "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
1.1       frystyk  3820: 
                   3821: Link object files or libraries together to form another library, or to
                   3822: create an executable program.
                   3823: 
                   3824: LINK-COMMAND is a command using the C compiler that you would use to create
                   3825: a program from several object files.
                   3826: 
                   3827: The following components of LINK-COMMAND are treated specially:
                   3828: 
1.2       frystyk  3829:   -all-static       do not do any dynamic linking at all
1.4       frystyk  3830:   -avoid-version    do not add a version suffix if possible
1.2       frystyk  3831:   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
1.4       frystyk  3832:   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
1.1       frystyk  3833:   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1.4       frystyk  3834:   -export-symbols SYMFILE
                   3835:                    try to export only the symbols listed in SYMFILE
1.5       frystyk  3836:   -export-symbols-regex REGEX
                   3837:                    try to export only the symbols matching REGEX
1.1       frystyk  3838:   -LLIBDIR          search LIBDIR for required installed libraries
                   3839:   -lNAME            OUTPUT-FILE requires the installed library libNAME
1.4       frystyk  3840:   -module           build a library that can dlopened
1.2       frystyk  3841:   -no-undefined     declare that a library does not refer to external symbols
1.1       frystyk  3842:   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
1.2       frystyk  3843:   -release RELEASE  specify package release information
1.1       frystyk  3844:   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
1.4       frystyk  3845:   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
1.2       frystyk  3846:   -static           do not do any dynamic linking of libtool libraries
1.1       frystyk  3847:   -version-info CURRENT[:REVISION[:AGE]]
1.4       frystyk  3848:                    specify library version info [each variable defaults to 0]
1.1       frystyk  3849: 
                   3850: All other options (arguments beginning with \`-') are ignored.
                   3851: 
                   3852: Every other argument is treated as a filename.  Files ending in \`.la' are
                   3853: treated as uninstalled libtool libraries, other files are standard or library
                   3854: object files.
                   3855: 
1.4       frystyk  3856: If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
                   3857: only library objects (\`.lo' files) may be specified, and \`-rpath' is
                   3858: required, except when creating a convenience library.
1.1       frystyk  3859: 
1.4       frystyk  3860: If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
                   3861: using \`ar' and \`ranlib', or on Windows using \`lib'.
1.1       frystyk  3862: 
1.4       frystyk  3863: If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
                   3864: is created, otherwise an executable program is created."
1.1       frystyk  3865:   ;;
                   3866: 
                   3867: uninstall)
1.5       frystyk  3868:   $echo \
1.2       frystyk  3869: "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1.1       frystyk  3870: 
                   3871: Remove libraries from an installation directory.
                   3872: 
                   3873: RM is the name of the program to use to delete files associated with each FILE
                   3874: (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
                   3875: to RM.
                   3876: 
                   3877: If FILE is a libtool library, all the files associated with it are deleted.
1.2       frystyk  3878: Otherwise, only FILE itself is deleted using RM."
1.1       frystyk  3879:   ;;
                   3880: 
                   3881: *)
1.2       frystyk  3882:   $echo "$modename: invalid operation mode \`$mode'" 1>&2
                   3883:   $echo "$help" 1>&2
1.1       frystyk  3884:   exit 1
                   3885:   ;;
                   3886: esac
                   3887: 
1.2       frystyk  3888: echo
                   3889: $echo "Try \`$modename --help' for more information about other modes."
1.1       frystyk  3890: 
                   3891: exit 0
                   3892: 
                   3893: # Local Variables:
                   3894: # mode:shell-script
                   3895: # sh-indentation:2
                   3896: # End:

Webmaster