5 |
# libtoolize (GNU @PACKAGE@@TIMESTAMP@) @VERSION@ |
# libtoolize (GNU @PACKAGE@@TIMESTAMP@) @VERSION@ |
6 |
# Written by Gary V. Vaughan <gary@gnu.org>, 2003 |
# Written by Gary V. Vaughan <gary@gnu.org>, 2003 |
7 |
|
|
8 |
# Copyright (C) 2003, 2004 Free Software Foundation, Inc. |
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. |
9 |
# This is free software; see the source for copying conditions. There is NO |
# This is free software; see the source for copying conditions. There is NO |
10 |
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
11 |
|
|
66 |
|
|
67 |
m4_include([getopt.m4sh]) |
m4_include([getopt.m4sh]) |
68 |
|
|
69 |
|
TAR=tar |
70 |
|
|
71 |
# Command line options: |
# Command line options: |
72 |
opt_force=false |
opt_force=false |
73 |
opt_install=false |
opt_install=false |
119 |
test -n "$LN_S" && LN_S="$ECHO $LN_S" |
test -n "$LN_S" && LN_S="$ECHO $LN_S" |
120 |
CP="$ECHO $CP" |
CP="$ECHO $CP" |
121 |
MKDIR="$ECHO $MKDIR" |
MKDIR="$ECHO $MKDIR" |
122 |
|
TAR="$ECHO $TAR" |
123 |
fi |
fi |
124 |
libtoolize_flags="${libtoolize_flags} --dry-run" |
libtoolize_flags="${libtoolize_flags} --dry-run" |
125 |
;; |
;; |
188 |
|
|
189 |
|
|
190 |
# func_copy srcfile destfile |
# func_copy srcfile destfile |
191 |
# If option `--copy' was specified, or soft-linking SRCFILE to DESTFILE fails, |
# A wrapper for func_copy_cb that accepts arguments in the same order |
192 |
# then try to copy SRCFILE to DESTFILE. |
# as the cp(1) shell command. |
193 |
func_copy () |
func_copy () |
194 |
{ |
{ |
195 |
$opt_debug |
$opt_debug |
196 |
my_srcfile="$1" |
|
197 |
my_destfile="$2" |
test -f "$1" || \ |
198 |
my_return_status=1 |
{ func_error "\`$1' not copied: not a regular file"; return 1; } |
199 |
|
|
200 |
func_mkdir_p `$ECHO "X$my_destfile" | $Xsed -e "$dirname"` |
my_f1=`$ECHO "X$1" | $Xsed -e "$basename"` |
201 |
|
|
202 |
$RM "$my_destfile" |
if test -d "$2"; then |
203 |
if $opt_link && $LN_S "$my_srcfile" "$my_destfile"; then |
|
204 |
$opt_quiet || func_echo "copying file \`$my_destfile'" |
func_copy_cb "$my_f1" `$ECHO "X$1" | $Xsed -e "$dirname"` "$2" |
205 |
my_return_status=0 |
|
|
elif $CP "$my_srcfile" "$my_destfile"; then |
|
|
$opt_quiet || func_echo "copying file \`$my_destfile'" |
|
|
my_return_status=0 |
|
206 |
else |
else |
207 |
func_error "can not copy \`$my_srcfile' to \`$my_destfile'" |
|
208 |
exit_status=$EXIT_FAILURE |
# Supporting this would mean changing the timestamp: |
209 |
|
test "X$my_f1" = X`$ECHO "X$2" | $Xsed -e "$basename"` \ |
210 |
|
|| func_fatal_error "func_copy() cannot change filename on copy" |
211 |
|
|
212 |
|
func_copy_cb "$my_f1" \ |
213 |
|
`$ECHO "X$1" | $Xsed -e "$dirname"` \ |
214 |
|
`$ECHO "X$2" | $Xsed -e "$dirname"` |
215 |
|
|
216 |
fi |
fi |
217 |
|
|
218 |
return $my_return_status |
return $copy_return_status # set in func_copy_cb |
219 |
} |
} |
220 |
|
|
221 |
|
|
222 |
# func_copy_cb filename srcdir destdir |
# func_copy_cb filename srcdir destdir |
223 |
# A wrapper for func_copy that accepts arguments in the order |
# If option `--copy' was specified, or soft-linking SRCFILE to DESTFILE fails, |
224 |
# used by func_copy_all_files callbacks. |
# then try to copy SRCFILE to DESTFILE (without changing the timestamp if |
225 |
|
# possible). |
226 |
func_copy_cb () |
func_copy_cb () |
227 |
{ |
{ |
228 |
$opt_debug |
$opt_debug |
229 |
func_copy "$2/$1" "$3/$1" |
my_file="$1" |
230 |
|
my_srcdir="$2" |
231 |
|
my_destdir="$3" |
232 |
|
copy_return_status=1 |
233 |
|
|
234 |
|
# Libtool is probably misinstalled if this happens: |
235 |
|
test -f "$my_srcdir/$my_file" || \ |
236 |
|
{ func_error "\`$my_file' not found in \`$my_srcdir'"; return; } |
237 |
|
|
238 |
|
func_mkdir_p "$my_destdir" |
239 |
|
|
240 |
|
$RM "$my_destdir/$my_file" |
241 |
|
if $opt_link && $LN_S "$my_srcdir/$my_file" "$my_destdir/$my_file"; then |
242 |
|
$opt_quiet || func_echo "copying file \`$my_destdir/$my_file'" |
243 |
|
copy_return_status=0 |
244 |
|
elif { ( cd "$my_srcdir" && $TAR cf - "$my_file" > /dev/null 2>&1; ) \ |
245 |
|
| ( cd "$my_destdir" && "$TAR" xf - > /dev/null 2>&1; ) } ; then |
246 |
|
$opt_quiet || func_echo "copying file \`$my_destdir/$my_file'" |
247 |
|
copy_return_status=0 |
248 |
|
elif $CP -p "$my_srcdir/$my_file" "$my_destdir/$my_file"; then |
249 |
|
$opt_quiet || func_echo "copying file \`$my_destdir/$my_file'" |
250 |
|
copy_return_status=0 |
251 |
|
else |
252 |
|
func_error "can not copy \`$my_srcdir/$my_file' to \`$my_destdir/'" |
253 |
|
exit_status=$EXIT_FAILURE |
254 |
|
fi |
255 |
} |
} |
256 |
|
|
257 |
|
|