#! /bin/sh# libtoolize - Prepare a package to use libtool.# @configure_input@# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2005# Free Software Foundation, Inc.# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful, but# WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU# General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.## As a special exception to the GNU General Public License, if you# distribute this file as part of a program that contains a# configuration script generated by Autoconf, you may include it under# the same distribution terms that you use for the rest of that program.# The name of this program.progname=`echo "$0" | sed 's%^.*/%%'`# Constants.PROGRAM=libtoolizePACKAGE=@PACKAGE@VERSION=@VERSION@# Directory names.prefix=@prefix@datarootdir=@datarootdir@datadir=@datadir@pkgdatadir=@pkgdatadir@aclocaldir=@aclocaldir@libtool_m4="$aclocaldir/libtool.m4"ltdl_m4="$aclocaldir/ltdl.m4"dry_run=nohelp="Try \`$progname --help' for more information."rm="rm -f"ln_s="@LN_S@"cp="cp -f -p"mkdir="mkdir"tar="tar"# Global variables.automake=copy=force=ltdl=ltdl_tar=configure_ac=status=0for argdocase "$arg" in--help)cat <<EOFUsage: $progname [OPTION]...Prepare a package to use libtool.--automake work silently, and assume that Automake is in use-c, --copy copy files rather than symlinking them--debug enable verbose shell tracing-n, --dry-run print commands rather than running them-f, --force replace existing files--help display this message and exit--ltdl install libltdl in a subdirectory--ltdl-tar install the libltdl tarball--version print version information and exitYou must \`cd' to the top directory of your package before you run\`$progname'.Report bugs to <bug-libtool@gnu.org>.EOFexit $?;;--version)echo "$PROGRAM (GNU $PACKAGE) $VERSION"echoecho "Copyright (C) 2005 Free Software Foundation, Inc."echo "This is free software; see the source for copying conditions. There is NO"echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."exit $?;;--automake)automake=yes;;-c | --copy)ln_s=;;--debug)echo "$progname: enabling shell trace mode"set -x;;-n | --dry-run)if test "$dry_run" != yes; thendry_run=yesrm="echo $rm"test -n "$ln_s" && ln_s="echo $ln_s"cp="echo $cp"mkdir="echo mkdir"tar="echo $tar"fi;;-f | --force)force=yes;;--ltdl)ltdl=yes;;--ltdl-tar)ltdl_tar=yes;;-*)echo "$progname: unrecognized option \`$arg'" 1>&2echo "$help" 1>&2exit 1;;*)echo "$progname: too many arguments" 1>&2echo "$help" 1>&2exit 1;;esacdoneif test -f configure.ac; thenconfigure_ac=configure.acelif test -f configure.in; thenconfigure_ac=configure.inelseecho "$progname: \`configure.ac' does not exist" 1>&2echo "$help" 1>&2exit 1fifiles=`cd $pkgdatadir && ls`if test -z "$files"; thenecho "$progname: cannot list files in \`$pkgdatadir'" 1>&2exit 1fifiles='config.guess config.sub ltmain.sh'auxdir=.auxdirline=`grep '^AC_CONFIG_AUX_DIR' $configure_ac 2>/dev/null`if test -n "$auxdirline"; then# Handle explicit AC_CONFIG_AUX_DIR settings.auxdir=`echo "$auxdirline" | sed 's/^AC_CONFIG_AUX_DIR(\([^)]*\)).*$/\1/'`if test "$auxdir" = "$auxdirline"; thenecho "$progname: invalid AC_CONFIG_AUX_DIR syntax: $auxdirline" 1>&2exit 1else# Strip any quote brackets.auxdir=`echo "$auxdir" | sed 's/^\[\(.*\)\]$/\1/g'`case "$auxdir" in*\$*)echo "$progname: cannot handle variables in AC_CONFIG_AUX_DIR" 1>&2exit 1;;*);;esacfielse# Try to discover auxdir the same way it is discovered by configure.# Note that we default to the current directory.for dir in . .. ../..; doif test -f $dir/install-sh; thenauxdir=$dirbreakelif test -f $dir/install.sh; thenauxdir=$dirbreakfidonefiif test -z "$automake"; thenif grep '^A[MC]_PROG_LIBTOOL' $configure_ac >/dev/null 2>&1; then :elseecho "Remember to add \`AC_PROG_LIBTOOL' to \`$configure_ac'."fiif grep '^AC_PROG_RANLIB' $configure_ac >/dev/null 2>&1; thenecho "Using \`AC_PROG_RANLIB' is rendered obsolete by \`AC_PROG_LIBTOOL'"fiif grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; thenupdatemsg="update your \`aclocal.m4' by running aclocal"elseupdatemsg="add the contents of \`$libtool_m4' to \`aclocal.m4'"fiif grep '^AC_DEFUN(\[A[MC]_PROG_LIBTOOL' aclocal.m4 >/dev/null 2>&1; then# Check the version number on libtool.m4 and the one used in aclocal.m4.instserial=`grep '^# serial ' $libtool_m4 | grep 'A[MC]_PROG_LIBTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`if test -z "$instserial"; thenecho "$progname: warning: no serial number on \`$libtool_m4'" 1>&2else# If the local macro has no serial number, we assume it's ancient.localserial=`grep '^# serial ' aclocal.m4 | grep 'A[MC]_PROG_LIBTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`test -z "$localserial" && localserial=0if test "$localserial" -lt "$instserial"; thenecho "You should $updatemsg."elif test "$localserial" -gt "$instserial"; thenecho "$progname: \`$libtool_m4' is serial $instserial, less than $localserial in \`aclocal.m4'" 1>&2if test -z "$force"; thenecho "Use \`--force' to replace newer libtool files with this version." 1>&2exit 1fiecho "To remain compatible, you should $updatemsg."fifielseecho "You should $updatemsg."fiif grep '^AC_LIB_LTDL' $configure_ac >/dev/null 2>&1; thenif grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; thenupdatemsg="update your \`aclocal.m4' by running aclocal"elseupdatemsg="add the contents of \`$ltdl_m4' to \`aclocal.m4'"fiif grep '^AC_DEFUN(AC_LIB_LTDL' aclocal.m4 >/dev/null 2>&1; then# Check the version number on ltdl.m4 and the one used in aclocal.m4.instserial=`grep '^# serial ' $ltdl_m4 | grep 'AC_LIB_LTDL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`if test -z "$instserial"; thenecho "$progname: warning: no serial number on \`$ltdl_m4'" 1>&2else# If the local macro has no serial number, we assume it's ancient.localserial=`grep '^# serial ' aclocal.m4 | grep 'AC_LIB_LTDL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`test -z "$localserial" && localserial=0if test "$localserial" -lt "$instserial"; thenecho "You should $updatemsg."elif test "$localserial" -gt "$instserial"; thenecho "$progname: \`$ltld_m4' is serial $instserial, less than $localserial in \`aclocal.m4'" 1>&2if test -z "$force"; thenecho "Use \`--force' to replace newer libtool files with this version." 1>&2exit 1fiecho "To remain compatible, you should $updatemsg."fifielseecho "You should $updatemsg."fififiif test "x$ltdl" = xyes; thentest -d libltdl || $mkdir libltdlltdlfiles=`cd $pkgdatadir && ls libltdl/*`elseltdlfiles=fifor file in $ltdlfiles; doif test -f "$file" && test -z "$force"; thentest -z "$automake" && echo "$progname: \`$file' exists: use \`--force' to overwrite" 1>&2continuefi$rm $fileif test -n "$ln_s" && $ln_s $pkgdatadir/$file $file; then :elif { ( cd $pkgdatadir 2>/dev/null && $tar chf - $file 2> /dev/null; ) \| ( umask 0 && $tar xf - > /dev/null 2>&1; ); } ; then :elif $cp $pkgdatadir/$file $file; then :elseecho "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2status=1fidoneif test "x$ltdl_tar" = x"yes"; thenif test "x$dry_run" = x"yes"; thenecho "tar -cf - libltdl | gzip --best > libltdl.tar.gz"elif test -f libltdl.tar.gz && test -z "$force"; thentest -z "$automake" && echo "$progname: \`libltdl.tar.gz' exists: use \`--force' to overwrite" 1>&2elsetest -d libltdl && ${rm}r libltdl$mkdir libltdlltdlfiles=`cd $pkgdatadir && ls libltdl/*`for file in $ltdlfiles; doif { ( cd $pkgdatadir 2>/dev/null && $tar chf - $file 2> /dev/null; ) \| ( umask 0 && $tar xf - > /dev/null 2>&1; ); } ; then :elif $cp $pkgdatadir/$file $file; then :elseecho "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2status=1breakfidonefor file in $files; doif { ( cd $pkgdatadir 2>/dev/null && $tar chf - $file 2> /dev/null; ) \| ( umask 0 && cd libltdl 2>/dev/null && $tar xf - > /dev/null 2>&1; ); } ; then :elif $cp $pkgdatadir/$file libltdl/$file; then :elseecho "$progname: cannot copy \`$pkgdatadir/$file' to \`libltdl/$file'" 1>&2status=1breakfidonetar -cf - libltdl | gzip --best > libltdl.tar.gz${rm}r libltdlfifi# Change to the auxiliary directory.if test "$auxdir" != .; thentest -z "$automake" && echo "Putting files in AC_CONFIG_AUX_DIR, \`$auxdir'."test "x$dry_run" = x"yes" && echo "cd $auxdir"cd $auxdir || exit 1fifor file in $files; doif test -f "$file" && test -z "$force"; thentest -z "$automake" && echo "$progname: \`$file' exists: use \`--force' to overwrite" 1>&2continuefi$rm $fileif test -n "$ln_s" && $ln_s $pkgdatadir/$file $file; then :elif { ( cd $pkgdatadir 2>/dev/null && $tar chf - $file 2> /dev/null; ) \| ( umask 0 && $tar xf - > /dev/null 2>&1; ); } ; then :elif $cp $pkgdatadir/$file $file; then :elseecho "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2status=1fidoneexit $status# Local Variables:# mode:shell-script# sh-indentation:2# End: