subversion: enable ssl
[msysgit.git] / bin / libtoolize
blob6e2715f391c6b56f06748c58fd89b5dd8bcb9837
1 #! /bin/sh
2 # libtoolize - Prepare a package to use libtool.
3 # libtoolize. Generated from libtoolize.in by configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2005
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
27 # The name of this program.
28 progname=`echo "$0" | sed 's%^.*/%%'`
30 # Constants.
31 PROGRAM=libtoolize
32 PACKAGE=libtool
33 VERSION=1.5.24
35 # Directory names.
36 prefix=
37 datarootdir=${prefix}/share
38 datadir=${datarootdir}
39 pkgdatadir=${datadir}/libtool
40 aclocaldir=${datadir}/aclocal
42 libtool_m4="$aclocaldir/libtool.m4"
43 ltdl_m4="$aclocaldir/ltdl.m4"
45 dry_run=no
46 help="Try \`$progname --help' for more information."
47 rm="rm -f"
48 ln_s="cp -p"
49 cp="cp -f -p"
50 mkdir="mkdir"
51 tar="tar"
53 # Global variables.
54 automake=
55 copy=
56 force=
57 ltdl=
58 ltdl_tar=
59 configure_ac=
60 status=0
62 for arg
64 case "$arg" in
65 --help)
66 cat <<EOF
67 Usage: $progname [OPTION]...
69 Prepare a package to use libtool.
71 --automake work silently, and assume that Automake is in use
72 -c, --copy copy files rather than symlinking them
73 --debug enable verbose shell tracing
74 -n, --dry-run print commands rather than running them
75 -f, --force replace existing files
76 --help display this message and exit
77 --ltdl install libltdl in a subdirectory
78 --ltdl-tar install the libltdl tarball
79 --version print version information and exit
81 You must \`cd' to the top directory of your package before you run
82 \`$progname'.
84 Report bugs to <bug-libtool@gnu.org>.
85 EOF
86 exit $?
89 --version)
90 echo "$PROGRAM (GNU $PACKAGE) $VERSION"
91 echo
92 echo "Copyright (C) 2005 Free Software Foundation, Inc."
93 echo "This is free software; see the source for copying conditions. There is NO"
94 echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
95 exit $?
98 --automake)
99 automake=yes
102 -c | --copy)
103 ln_s=
106 --debug)
107 echo "$progname: enabling shell trace mode"
108 set -x
111 -n | --dry-run)
112 if test "$dry_run" != yes; then
113 dry_run=yes
114 rm="echo $rm"
115 test -n "$ln_s" && ln_s="echo $ln_s"
116 cp="echo $cp"
117 mkdir="echo mkdir"
118 tar="echo $tar"
122 -f | --force)
123 force=yes
126 --ltdl)
127 ltdl=yes
130 --ltdl-tar)
131 ltdl_tar=yes
135 echo "$progname: unrecognized option \`$arg'" 1>&2
136 echo "$help" 1>&2
137 exit 1
141 echo "$progname: too many arguments" 1>&2
142 echo "$help" 1>&2
143 exit 1
145 esac
146 done
148 if test -f configure.ac; then
149 configure_ac=configure.ac
150 elif test -f configure.in; then
151 configure_ac=configure.in
152 else
153 echo "$progname: \`configure.ac' does not exist" 1>&2
154 echo "$help" 1>&2
155 exit 1
159 files=`cd $pkgdatadir && ls`
160 if test -z "$files"; then
161 echo "$progname: cannot list files in \`$pkgdatadir'" 1>&2
162 exit 1
164 files='config.guess config.sub ltmain.sh'
166 auxdir=.
167 auxdirline=`grep '^AC_CONFIG_AUX_DIR' $configure_ac 2>/dev/null`
168 if test -n "$auxdirline"; then
169 # Handle explicit AC_CONFIG_AUX_DIR settings.
170 auxdir=`echo "$auxdirline" | sed 's/^AC_CONFIG_AUX_DIR(\([^)]*\)).*$/\1/'`
172 if test "$auxdir" = "$auxdirline"; then
173 echo "$progname: invalid AC_CONFIG_AUX_DIR syntax: $auxdirline" 1>&2
174 exit 1
175 else
176 # Strip any quote brackets.
177 auxdir=`echo "$auxdir" | sed 's/^\[\(.*\)\]$/\1/g'`
178 case "$auxdir" in
179 *\$*)
180 echo "$progname: cannot handle variables in AC_CONFIG_AUX_DIR" 1>&2
181 exit 1
185 esac
187 else
188 # Try to discover auxdir the same way it is discovered by configure.
189 # Note that we default to the current directory.
190 for dir in . .. ../..; do
191 if test -f $dir/install-sh; then
192 auxdir=$dir
193 break
194 elif test -f $dir/install.sh; then
195 auxdir=$dir
196 break
198 done
201 if test -z "$automake"; then
202 if grep '^A[MC]_PROG_LIBTOOL' $configure_ac >/dev/null 2>&1; then :
203 else
204 echo "Remember to add \`AC_PROG_LIBTOOL' to \`$configure_ac'."
207 if grep '^AC_PROG_RANLIB' $configure_ac >/dev/null 2>&1; then
208 echo "Using \`AC_PROG_RANLIB' is rendered obsolete by \`AC_PROG_LIBTOOL'"
211 if grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; then
212 updatemsg="update your \`aclocal.m4' by running aclocal"
213 else
214 updatemsg="add the contents of \`$libtool_m4' to \`aclocal.m4'"
217 if grep '^AC_DEFUN(\[A[MC]_PROG_LIBTOOL' aclocal.m4 >/dev/null 2>&1; then
218 # Check the version number on libtool.m4 and the one used in aclocal.m4.
219 instserial=`grep '^# serial ' $libtool_m4 | grep 'A[MC]_PROG_LIBTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`
221 if test -z "$instserial"; then
222 echo "$progname: warning: no serial number on \`$libtool_m4'" 1>&2
223 else
224 # If the local macro has no serial number, we assume it's ancient.
225 localserial=`grep '^# serial ' aclocal.m4 | grep 'A[MC]_PROG_LIBTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`
227 test -z "$localserial" && localserial=0
229 if test "$localserial" -lt "$instserial"; then
230 echo "You should $updatemsg."
231 elif test "$localserial" -gt "$instserial"; then
232 echo "$progname: \`$libtool_m4' is serial $instserial, less than $localserial in \`aclocal.m4'" 1>&2
233 if test -z "$force"; then
234 echo "Use \`--force' to replace newer libtool files with this version." 1>&2
235 exit 1
237 echo "To remain compatible, you should $updatemsg."
240 else
241 echo "You should $updatemsg."
244 if grep '^AC_LIB_LTDL' $configure_ac >/dev/null 2>&1; then
245 if grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; then
246 updatemsg="update your \`aclocal.m4' by running aclocal"
247 else
248 updatemsg="add the contents of \`$ltdl_m4' to \`aclocal.m4'"
251 if grep '^AC_DEFUN(AC_LIB_LTDL' aclocal.m4 >/dev/null 2>&1; then
252 # Check the version number on ltdl.m4 and the one used in aclocal.m4.
253 instserial=`grep '^# serial ' $ltdl_m4 | grep 'AC_LIB_LTDL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`
255 if test -z "$instserial"; then
256 echo "$progname: warning: no serial number on \`$ltdl_m4'" 1>&2
257 else
258 # If the local macro has no serial number, we assume it's ancient.
259 localserial=`grep '^# serial ' aclocal.m4 | grep 'AC_LIB_LTDL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`
261 test -z "$localserial" && localserial=0
263 if test "$localserial" -lt "$instserial"; then
264 echo "You should $updatemsg."
265 elif test "$localserial" -gt "$instserial"; then
266 echo "$progname: \`$ltld_m4' is serial $instserial, less than $localserial in \`aclocal.m4'" 1>&2
267 if test -z "$force"; then
268 echo "Use \`--force' to replace newer libtool files with this version." 1>&2
269 exit 1
271 echo "To remain compatible, you should $updatemsg."
274 else
275 echo "You should $updatemsg."
281 if test "x$ltdl" = xyes; then
282 test -d libltdl || $mkdir libltdl
283 ltdlfiles=`cd $pkgdatadir && ls libltdl/*`
284 if test -z "$ltdlfiles"; then
285 echo "$progname: cannot list files in \`$pkgdatadir/libltdl'" 1>&2
286 exit 1
288 else
289 ltdlfiles=
292 for file in $ltdlfiles; do
293 if test -f "$file" && test -z "$force"; then
294 test -z "$automake" && echo "$progname: \`$file' exists: use \`--force' to overwrite" 1>&2
295 continue
298 $rm $file
299 if test -n "$ln_s" && $ln_s $pkgdatadir/$file $file; then :
300 elif { ( cd $pkgdatadir 2>/dev/null && $tar chf - $file 2> /dev/null; ) \
301 | ( umask 0 && $tar xf - > /dev/null 2>&1; ); } ; then :
302 elif $cp $pkgdatadir/$file $file; then :
303 else
304 echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2
305 status=1
307 done
309 if test "x$ltdl_tar" = x"yes"; then
310 if test "x$dry_run" = x"yes"; then
311 echo "tar -cf - libltdl | gzip --best > libltdl.tar.gz"
312 elif test -f libltdl.tar.gz && test -z "$force"; then
313 test -z "$automake" && echo "$progname: \`libltdl.tar.gz' exists: use \`--force' to overwrite" 1>&2
314 else
315 test -d libltdl && ${rm}r libltdl
316 $mkdir libltdl
317 ltdlfiles=`cd $pkgdatadir && ls libltdl/*`
318 for file in $ltdlfiles; do
319 if { ( cd $pkgdatadir 2>/dev/null && $tar chf - $file 2> /dev/null; ) \
320 | ( umask 0 && $tar xf - > /dev/null 2>&1; ); } ; then :
321 elif $cp $pkgdatadir/$file $file; then :
322 else
323 echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2
324 status=1
325 break
327 done
328 for file in $files; do
329 if { ( cd $pkgdatadir 2>/dev/null && $tar chf - $file 2> /dev/null; ) \
330 | ( umask 0 && cd libltdl 2>/dev/null && $tar xf - > /dev/null 2>&1; ); } ; then :
331 elif $cp $pkgdatadir/$file libltdl/$file; then :
332 else
333 echo "$progname: cannot copy \`$pkgdatadir/$file' to \`libltdl/$file'" 1>&2
334 status=1
335 break
337 done
338 tar -cf - libltdl | gzip --best > libltdl.tar.gz
339 ${rm}r libltdl
343 # Change to the auxiliary directory.
344 if test "$auxdir" != .; then
345 test -z "$automake" && echo "Putting files in AC_CONFIG_AUX_DIR, \`$auxdir'."
346 test "x$dry_run" = x"yes" && echo "cd $auxdir"
347 cd $auxdir || exit 1
350 for file in $files; do
351 if test -f "$file" && test -z "$force"; then
352 test -z "$automake" && echo "$progname: \`$file' exists: use \`--force' to overwrite" 1>&2
353 continue
356 $rm $file
357 if test -n "$ln_s" && $ln_s $pkgdatadir/$file $file; then :
358 elif { ( cd $pkgdatadir 2>/dev/null && $tar chf - $file 2> /dev/null; ) \
359 | ( umask 0 && $tar xf - > /dev/null 2>&1; ); } ; then :
360 elif $cp $pkgdatadir/$file $file; then :
361 else
362 echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2
363 status=1
365 done
367 exit $status
369 # Local Variables:
370 # mode:shell-script
371 # sh-indentation:2
372 # End: