#! /bin/sh # libtoolize - Prepare a package to use libtool. # @configure_input@ # Copyright (C) 1996-2000 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # The name of this program. progname=`echo "$0" | sed 's%^.*/%%'` # Constants. PROGRAM=libtoolize PACKAGE=@PACKAGE@ VERSION=@VERSION@ # Directory names. prefix=@prefix@ datadir=@datadir@ pkgdatadir=@pkgdatadir@ aclocaldir=@aclocaldir@ libtool_m4="$aclocaldir/libtool.m4" ltdl_m4="$aclocaldir/ltdl.m4" dry_run=no help="Try \`$progname --help' for more information." rm="rm -f" ln_s="ln -s" cp="cp -f" mkdir="mkdir" # Global variables. automake= copy= force= ltdl= ltdl_tar= status=0 for arg do case "$arg" in --help) cat <&2 echo "$help" 1>&2 exit 1 ;; *) echo "$progname: too many arguments" 1>&2 echo "$help" 1>&2 exit 1 ;; esac done if test ! -f configure.in; then echo "$progname: \`configure.in' does not exist" 1>&2 echo "$help" 1>&2 exit 1 fi files=`cd $pkgdatadir && ls` if test -z "$files"; then echo "$progname: cannot list files in \`$pkgdatadir'" 1>&2 exit 1 fi files='config.guess config.sub ltconfig ltmain.sh' auxdir=. auxdirline=`egrep '^AC_CONFIG_AUX_DIR' configure.in 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"; then echo "$progname: invalid AC_CONFIG_AUX_DIR syntax: $auxdirline" 1>&2 exit 1 else # 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>&2 exit 1 ;; *) ;; esac fi else # Try to discover auxdir the same way it is discovered by configure. # Note that we default to the current directory. for dir in . .. ../..; do if test -f $dir/install-sh; then auxdir=$dir break elif test -f $dir/install.sh; then auxdir=$dir break fi done fi if test -z "$automake"; then if egrep '^A[MC]_PROG_LIBTOOL' configure.in >/dev/null 2>&1; then : else echo "Remember to add \`AM_PROG_LIBTOOL' to \`configure.in'." fi if egrep '^AC_PROG_RANLIB' configure.in >/dev/null 2>&1; then echo "Using \`AC_PROG_RANLIB' is rendered obsolete by \`AM_PROG_LIBTOOL'" fi if grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; then updatemsg="update your \`aclocal.m4' by running aclocal" else updatemsg="add the contents of \`$libtool_m4' to \`aclocal.m4'" fi if egrep '^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"; then echo "$progname: warning: no serial number on \`$libtool_m4'" 1>&2 else # 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=0 if test "$localserial" -lt "$instserial"; then echo "You should $updatemsg." elif test "$localserial" -gt "$instserial"; then echo "$progname: \`$libtool_m4' is serial $instserial, less than $localserial in \`aclocal.m4'" 1>&2 if test -z "$force"; then echo "Use \`--force' to replace newer libtool files with this version." 1>&2 exit 1 fi echo "To remain compatible, you should $updatemsg." fi fi else echo "You should $updatemsg." fi if grep '^AC_LIB_LTDL' configure.in >/dev/null 2>&1; then if grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; then updatemsg="update your \`aclocal.m4' by running aclocal" else updatemsg="add the contents of \`$ltdl_m4' to \`aclocal.m4'" fi if egrep '^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"; then echo "$progname: warning: no serial number on \`$ltdl_m4'" 1>&2 else # 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=0 if test "$localserial" -lt "$instserial"; then echo "You should $updatemsg." elif test "$localserial" -gt "$instserial"; then echo "$progname: \`$ltld_m4' is serial $instserial, less than $localserial in \`aclocal.m4'" 1>&2 if test -z "$force"; then echo "Use \`--force' to replace newer libtool files with this version." 1>&2 exit 1 fi echo "To remain compatible, you should $updatemsg." fi fi else echo "You should $updatemsg." fi fi fi if test "x$ltdl" = xyes; then test -d libltdl || $mkdir libltdl ltdlfiles=`cd $pkgdatadir && ls libltdl/*` else ltdlfiles= fi for file in $ltdlfiles; do if test -f "$file" && test -z "$force"; then test -z "$automake" && echo "$progname: \`$file' exists: use \`--force' to overwrite" 1>&2 continue fi $rm $file if test -n "$ln_s" && $ln_s $pkgdatadir/$file $file; then : elif $cp $pkgdatadir/$file $file; then : else echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2 status=1 fi done if test "x$ltdl_tar" = x"yes"; then if test "x$dry_run" = x"yes"; then echo "tar -cf - libltdl | gzip --best > libltdl.tar.gz" elif test -f libltdl.tar.gz && test -z "$force"; then test -z "$automake" && echo "$progname: \`libltdl.tar.gz' exists: use \`--force' to overwrite" 1>&2 else test -d libltdl && ${rm}r libltdl $mkdir libltdl ltdlfiles=`cd $pkgdatadir && ls libltdl/*` for file in $ltdlfiles; do if $cp $pkgdatadir/$file $file; then : else echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2 status=1 break fi done for file in $files; do if $cp $pkgdatadir/$file libltdl/$file; then : else echo "$progname: cannot copy \`$pkgdatadir/$file' to \`libltdl/$file'" 1>&2 status=1 break fi done tar -cf - libltdl | gzip --best > libltdl.tar.gz ${rm}r libltdl fi fi # Change to the auxiliary directory. if test "$auxdir" != .; then test -z "$automake" && echo "Putting files in AC_CONFIG_AUX_DIR, \`$auxdir'." cd $auxdir || exit 1 fi for file in $files; do if test -f "$file" && test -z "$force"; then test -z "$automake" && echo "$progname: \`$file' exists: use \`--force' to overwrite" 1>&2 continue fi $rm $file if test -n "$ln_s" && $ln_s $pkgdatadir/$file $file; then : elif $cp $pkgdatadir/$file $file; then : else echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2 status=1 fi done exit $status # Local Variables: # mode:shell-script # sh-indentation:2 # End: