1 # help.at -- standard command line options -*- Autotest -*-
3 # Copyright (C) 2009, 2010 Free Software Foundation, Inc.
5 # This file is part of GNU Libtool.
7 # GNU Libtool is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation; either version 2 of
10 # the License, or (at your option) any later version.
12 # GNU Libtool is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Libtool; see the file COPYING. If not, a copy
19 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
20 # or obtained by writing to the Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 AT_BANNER([Testing libtool functions.])
26 AT_SETUP([standard command line options])
27 AT_KEYWORDS([libtool])
28 AT_KEYWORDS([libtoolize])
30 AT_CHECK([$LIBTOOLIZE --help], [], [ignore])
31 AT_CHECK([$LIBTOOLIZE --version], [], [stdout])
32 AT_CHECK([grep 'Copyright.*Free Software Foundation' stdout], [], [ignore])
33 AT_CHECK([$LIBTOOL --help], [], [ignore])
34 AT_CHECK([$LIBTOOL --help-all], [], [ignore])
35 AT_CHECK([$LIBTOOL --version], [], [stdout])
36 AT_CHECK([grep 'Copyright.*Free Software Foundation' stdout], [], [ignore])
38 AT_CHECK([$LIBTOOL], [1], [ignore], [stderr])
39 AT_CHECK([grep 'specify a MODE' stderr], [], [ignore])
40 AT_CHECK([grep ' --help' stderr], [], [ignore])
45 AT_SETUP([mode short-hands])
48 [[int a () { return 0; }
53 int main () { return a (); }
59 mkdir $inst $libdir $bindir
61 AT_CHECK([$LIBTOOL compile $CC $CPPFLAGS $CFLAGS -c a.c],
62 [], [ignore], [ignore])
63 AT_CHECK([$LIBTOOL co $CC $CPPFLAGS $CFLAGS -c main.c],
64 [], [ignore], [ignore])
65 AT_CHECK([$LIBTOOL co $CC $CPPFLAGS $CFLAGS -c main.c],
66 [], [ignore], [ignore])
67 AT_CHECK([$LIBTOOL link $CC $CFLAGS $LDFLAGS -o liba.la a.lo ]dnl
68 [-no-undefined -rpath $libdir], [], [ignore], [ignore])
69 AT_CHECK([$LIBTOOL l $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.lo ]dnl
70 [liba.la], [], [ignore], [ignore])
71 AT_CHECK([$LIBTOOL execute --dry-run ./main$EXEEXT],
72 [], [ignore], [ignore])
73 AT_CHECK([$LIBTOOL exe --dry-run ./main$EXEEXT],
74 [], [ignore], [ignore])
75 AT_CHECK([$LIBTOOL e --dry-run ./main$EXEEXT],
76 [], [ignore], [ignore])
77 AT_CHECK([$LIBTOOL install cp liba.la $libdir],
78 [], [ignore], [ignore])
79 AT_CHECK([$LIBTOOL i cp main$EXEEXT $bindir],
80 [], [ignore], [ignore])
81 AT_CHECK([$LIBTOOL finish $libdir],
82 [], [ignore], [ignore])
83 AT_CHECK([$LIBTOOL f $libdir],
84 [], [ignore], [ignore])
85 AT_CHECK([$LIBTOOL uninstall rm -f $libdir/liba.la],
86 [], [ignore], [ignore])
87 AT_CHECK([$LIBTOOL u rm -f $bindir/main$EXEEXT],
88 [], [ignore], [ignore])
89 AT_CHECK([$LIBTOOL clean rm -f main$EXEEXT],
90 [], [ignore], [ignore])
91 AT_CHECK([$LIBTOOL cl liba.la],
92 [], [ignore], [ignore])
97 AT_SETUP([debug tracing])
100 [[int a () { return 0; }
105 int b () { return a (); }
110 int main () { return b (); }
116 mkdir $inst $libdir $bindir
118 # This test will not work correctly if --debug is passed.
119 AT_CHECK([case "$LIBTOOL $CC $CPPFLAGS $CFLAGS $LDFLAGS " in ]dnl
120 [ *\ --debug\ *) exit 77;; *) :;; esac])
124 if test "X$trace" = X--debug; then
125 AT_CHECK([grep 'enabling shell trace mode' stdout stderr], [0], [ignore])
126 AT_CHECK([grep ' --mode' stderr], [0], [ignore])
128 AT_CHECK([grep 'enabling shell trace mode' stdout stderr], [1])
129 AT_CHECK([grep ' --mode' stderr], [1])
133 orig_LIBTOOL=$LIBTOOL
134 for trace in '' --debug; do
135 LIBTOOL="$orig_LIBTOOL $trace"
137 # Hypothesis: debug output should happen if (and only if) --debug is
138 # passed, for compile, link, install, uninstall, and clean modes.
139 AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c],
140 [], [stdout], [stderr])
142 AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c b.c],
143 [], [stdout], [stderr])
145 AT_CHECK([$CC $CPPFLAGS $CFLAGS -c main.c], [], [ignore], [ignore])
146 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo ]dnl
147 [ -no-undefined -rpath $libdir], [], [stdout], [stderr])
149 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb.la b.lo ]dnl
150 [ -no-undefined -rpath $libdir liba.la], [], [stdout], [stderr])
152 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT ]dnl
153 [libb.la], [], [stdout], [stderr])
155 LT_AT_NOINST_EXEC_CHECK([./main], [], [], [stdout], [stderr])
158 AT_CHECK([$LIBTOOL --mode=install cp liba.la libb.la $libdir],
159 [], [stdout], [stderr])
162 # Hypothesis: --debug should be passed to relink mode if (and only if)
163 # it was passed at link mode.
164 AT_CHECK([$orig_LIBTOOL --mode=install $lt_INSTALL liba.la libb.la $libdir],
165 [], [stdout], [stderr])
166 if grep ': relinking ' stdout stderr; then
167 if test "X$trace" = X--debug; then
168 AT_CHECK([grep ' --mode=relink' stdout stderr | grep ' --debug '],
171 AT_CHECK([grep ' --mode=relink' stdout stderr | grep ' --debug '],
176 AT_CHECK([$LIBTOOL --mode=install cp main$EXEEXT $bindir],
177 [], [stdout], [stderr])
179 AT_CHECK([$LIBTOOL --mode=finish $bindir], [], [stdout], [stderr])
182 AT_CHECK([$LIBTOOL --mode=uninstall rm -f $bindir/main$EXEEXT ]dnl
183 [$libdir/libb.la $libdir/liba.la], [], [stdout], [stderr])
185 AT_CHECK([$LIBTOOL --mode=clean rm -f $bindir/main$EXEEXT ]dnl
186 [$libdir/libb.la $libdir/liba.la], [], [stdout], [stderr])