Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / bin / libtoolize
blobb3cdaa13eaea60d27827d8130b8c113ddb505a28
1 #! /bin/sh
2 # libtoolize - Prepare a package to use libtool.
3 # libtoolize. Generated from libtoolize.in by configure.
4 # Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc.
5 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
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.
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.
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.
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.
26 # The name of this program.
27 progname=`echo "$0" | sed 's%^.*/%%'`
29 # Constants.
30 PROGRAM=libtoolize
31 PACKAGE=libtool
32 VERSION=1.4e
34 # Directory names.
35 prefix=/usr
36 datadir=${prefix}/share
37 pkgdatadir=${datadir}/libtool
38 aclocaldir=${datadir}/aclocal
40 libtool_m4="$aclocaldir/libtool.m4"
41 ltdl_m4="$aclocaldir/ltdl.m4"
43 dry_run=no
44 help="Try \`$progname --help' for more information."
45 rm="rm -f"
46 ln_s="ln -s"
47 cp="cp -f"
48 mkdir="mkdir"
50 # Global variables.
51 automake=
52 copy=
53 force=
54 ltdl=
55 ltdl_tar=
56 configure_ac=
57 status=0
59 for arg
61 case "$arg" in
62 --help)
63 cat <<EOF
64 Usage: $progname [OPTION]...
66 Prepare a package to use libtool.
68 --automake work silently, and assume that Automake is in use
69 -c, --copy copy files rather than symlinking them
70 --debug enable verbose shell tracing
71 -n, --dry-run print commands rather than running them
72 -f, --force replace existing files
73 --help display this message and exit
74 --ltdl install libltdl in a subdirectory
75 --ltdl-tar install the libltdl tarball
76 --version print version information and exit
78 You must \`cd' to the top directory of your package before you run
79 \`$progname'.
80 EOF
81 exit 0
84 --version)
85 echo "$PROGRAM (GNU $PACKAGE) $VERSION"
86 echo
87 echo "Copyright 1996-2000, 2001 Free Software Foundation, Inc."
88 echo "This is free software; see the source for copying conditions. There is NO"
89 echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
90 exit 0
93 --automake)
94 automake=yes
97 -c | --copy)
98 ln_s=
101 --debug)
102 echo "$progname: enabling shell trace mode"
103 set -x
106 -n | --dry-run)
107 if test "$dry_run" != yes; then
108 dry_run=yes
109 rm="echo $rm"
110 test -n "$ln_s" && ln_s="echo $ln_s"
111 cp="echo $cp"
112 mkdir="echo mkdir"
116 -f | --force)
117 force=yes
120 --ltdl)
121 ltdl=yes
124 --ltdl-tar)
125 ltdl_tar=yes
129 echo "$progname: unrecognized option \`$arg'" 1>&2
130 echo "$help" 1>&2
131 exit 1
135 echo "$progname: too many arguments" 1>&2
136 echo "$help" 1>&2
137 exit 1
139 esac
140 done
142 if test -f configure.ac; then
143 configure_ac=configure.ac
144 elif test -f configure.in; then
145 configure_ac=configure.in
146 else
147 echo "$progname: \`configure.ac' does not exist" 1>&2
148 echo "$help" 1>&2
149 exit 1
153 files=`cd $pkgdatadir && ls`
154 if test -z "$files"; then
155 echo "$progname: cannot list files in \`$pkgdatadir'" 1>&2
156 exit 1
158 files='config.guess config.sub ltmain.sh'
160 auxdir=.
161 auxdirline=`grep '^AC_CONFIG_AUX_DIR' $configure_ac 2>/dev/null`
162 if test -n "$auxdirline"; then
163 # Handle explicit AC_CONFIG_AUX_DIR settings.
164 auxdir=`echo "$auxdirline" | sed 's/^AC_CONFIG_AUX_DIR(\([^)]*\)).*$/\1/'`
166 if test "$auxdir" = "$auxdirline"; then
167 echo "$progname: invalid AC_CONFIG_AUX_DIR syntax: $auxdirline" 1>&2
168 exit 1
169 else
170 # Strip any quote brackets.
171 auxdir=`echo "$auxdir" | sed 's/^\[\(.*\)\]$/\1/g'`
172 case "$auxdir" in
173 *\$*)
174 echo "$progname: cannot handle variables in AC_CONFIG_AUX_DIR" 1>&2
175 exit 1
179 esac
181 else
182 # Try to discover auxdir the same way it is discovered by configure.
183 # Note that we default to the current directory.
184 for dir in . .. ../..; do
185 if test -f $dir/install-sh; then
186 auxdir=$dir
187 break
188 elif test -f $dir/install.sh; then
189 auxdir=$dir
190 break
192 done
195 if test -z "$automake"; then
196 if grep '^A[MC]_PROG_LIBTOOL' $configure_ac >/dev/null 2>&1; then :
197 else
198 echo "Remember to add \`AC_PROG_LIBTOOL' to \`$configure_ac'."
201 if grep '^AC_PROG_RANLIB' $configure_ac >/dev/null 2>&1; then
202 echo "Using \`AC_PROG_RANLIB' is rendered obsolete by \`AC_PROG_LIBTOOL'"
205 if grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; then
206 updatemsg="update your \`aclocal.m4' by running aclocal"
207 else
208 updatemsg="add the contents of \`$libtool_m4' to \`aclocal.m4'"
211 if grep '^AC_DEFUN(\[A[MC]_PROG_LIBTOOL' aclocal.m4 >/dev/null 2>&1; then
212 # Check the version number on libtool.m4 and the one used in aclocal.m4.
213 instserial=`grep '^# serial ' $libtool_m4 | grep 'A[MC]_PROG_LIBTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`
215 if test -z "$instserial"; then
216 echo "$progname: warning: no serial number on \`$libtool_m4'" 1>&2
217 else
218 # If the local macro has no serial number, we assume it's ancient.
219 localserial=`grep '^# serial ' aclocal.m4 | grep 'A[MC]_PROG_LIBTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`
221 test -z "$localserial" && localserial=0
223 if test "$localserial" -lt "$instserial"; then
224 echo "You should $updatemsg."
225 elif test "$localserial" -gt "$instserial"; then
226 echo "$progname: \`$libtool_m4' is serial $instserial, less than $localserial in \`aclocal.m4'" 1>&2
227 if test -z "$force"; then
228 echo "Use \`--force' to replace newer libtool files with this version." 1>&2
229 exit 1
231 echo "To remain compatible, you should $updatemsg."
234 else
235 echo "You should $updatemsg."
238 if grep '^AC_LIB_LTDL' $configure_ac >/dev/null 2>&1; then
239 if grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; then
240 updatemsg="update your \`aclocal.m4' by running aclocal"
241 else
242 updatemsg="add the contents of \`$ltdl_m4' to \`aclocal.m4'"
245 if grep '^AC_DEFUN(AC_LIB_LTDL' aclocal.m4 >/dev/null 2>&1; then
246 # Check the version number on ltdl.m4 and the one used in aclocal.m4.
247 instserial=`grep '^# serial ' $ltdl_m4 | grep 'AC_LIB_LTDL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`
249 if test -z "$instserial"; then
250 echo "$progname: warning: no serial number on \`$ltdl_m4'" 1>&2
251 else
252 # If the local macro has no serial number, we assume it's ancient.
253 localserial=`grep '^# serial ' aclocal.m4 | grep 'AC_LIB_LTDL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`
255 test -z "$localserial" && localserial=0
257 if test "$localserial" -lt "$instserial"; then
258 echo "You should $updatemsg."
259 elif test "$localserial" -gt "$instserial"; then
260 echo "$progname: \`$ltld_m4' is serial $instserial, less than $localserial in \`aclocal.m4'" 1>&2
261 if test -z "$force"; then
262 echo "Use \`--force' to replace newer libtool files with this version." 1>&2
263 exit 1
265 echo "To remain compatible, you should $updatemsg."
268 else
269 echo "You should $updatemsg."
275 if test "x$ltdl" = xyes; then
276 test -d libltdl || $mkdir libltdl
277 ltdlfiles=`cd $pkgdatadir && ls libltdl/*`
278 else
279 ltdlfiles=
282 for file in $ltdlfiles; do
283 if test -f "$file" && test -z "$force"; then
284 test -z "$automake" && echo "$progname: \`$file' exists: use \`--force' to overwrite" 1>&2
285 continue
288 $rm $file
289 if test -n "$ln_s" && $ln_s $pkgdatadir/$file $file; then :
290 elif $cp $pkgdatadir/$file $file; then :
291 else
292 echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2
293 status=1
295 done
297 if test "x$ltdl_tar" = x"yes"; then
298 if test "x$dry_run" = x"yes"; then
299 echo "tar -cf - libltdl | gzip --best > libltdl.tar.gz"
300 elif test -f libltdl.tar.gz && test -z "$force"; then
301 test -z "$automake" && echo "$progname: \`libltdl.tar.gz' exists: use \`--force' to overwrite" 1>&2
302 else
303 test -d libltdl && ${rm}r libltdl
304 $mkdir libltdl
305 ltdlfiles=`cd $pkgdatadir && ls libltdl/*`
306 for file in $ltdlfiles; do
307 if $cp $pkgdatadir/$file $file; then :
308 else
309 echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2
310 status=1
311 break
313 done
314 for file in $files; do
315 if $cp $pkgdatadir/$file libltdl/$file; then :
316 else
317 echo "$progname: cannot copy \`$pkgdatadir/$file' to \`libltdl/$file'" 1>&2
318 status=1
319 break
321 done
322 tar -cf - libltdl | gzip --best > libltdl.tar.gz
323 ${rm}r libltdl
327 # Change to the auxiliary directory.
328 if test "$auxdir" != .; then
329 test -z "$automake" && echo "Putting files in AC_CONFIG_AUX_DIR, \`$auxdir'."
330 cd $auxdir || exit 1
333 for file in $files; do
334 if test -f "$file" && test -z "$force"; then
335 test -z "$automake" && echo "$progname: \`$file' exists: use \`--force' to overwrite" 1>&2
336 continue
339 $rm $file
340 if test -n "$ln_s" && $ln_s $pkgdatadir/$file $file; then :
341 elif $cp $pkgdatadir/$file $file; then :
342 else
343 echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2
344 status=1
346 done
348 exit $status
350 # Local Variables:
351 # mode:shell-script
352 # sh-indentation:2
353 # End: