ltmain.in: Use func_warning for all warnings
[libtool.git] / tests / early-libtool.at
blob3bbe5a9bc2443d7825213d53af60f33122485583
1 # early-libtool.at -- early libtool script generation         -*- Autotest -*-
3 #   Copyright (C) 2005-2008, 2011-2019, 2021-2024 Free Software
4 #   Foundation, Inc.
5 #   Written by Gary V. Vaughan, 2005
7 #   This file is part of GNU Libtool.
9 # GNU Libtool is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation; either version 2 of
12 # the License, or (at your option) any later version.
14 # GNU Libtool is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with GNU Libtool; see the file COPYING.  If not, a copy
21 # can be downloaded from  http://www.gnu.org/licenses/gpl.html,
22 # or obtained by writing to the Free Software Foundation, Inc.,
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 ####
26 AT_BANNER([libtool script generation.])
29 ## --------------------------------------------- ##
30 ## Building libtool normally from config.status. ##
31 ## --------------------------------------------- ##
33 AT_SETUP([config.status])
35 AT_DATA([configure.ac],
36 [[AC_INIT([libtool-demo], ]]AT_PACKAGE_VERSION[[, ]]AT_PACKAGE_BUGREPORT[[)
37 AC_CONFIG_MACRO_DIRS([m4])
38 LT_INIT
39 AC_CONFIG_FILES([Makefile])
40 AC_OUTPUT
41 ]])
43 AT_DATA([Makefile.in],
44 [[prefix = @prefix@
45 libdir = @libdir@
46 top_builddir = .
47 SHELL = @SHELL@
48 DEFAULT_INCLUDES = -I. -I@srcdir@
49 EXEEXT = @EXEEXT@
50 LIBTOOL = @LIBTOOL@
51 OBJEXT = @OBJEXT@
53 CPPFLAGS = @CPPFLAGS@
54 CFLAGS = @CFLAGS@
55 LDFLAGS = @LDFLAGS@
57 COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFAULT_INCLUDES)
58 LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFAULT_INCLUDES)
59 LINK = $(LIBTOOL) --mode=link --tag=CC $(CC) $(CFLAGS) $(LDFLAGS) -o $@
61 all: hell$(EXEEXT)
63 libhello.la: hello.lo
64         $(LINK) -rpath $(libdir) hello.lo
65 hell$(EXEEXT): main.$(OBJEXT) libhello.la
66         $(LINK) main.$(OBJEXT) libhello.la
68 .SUFFIXES:
69 .SUFFIXES: .c .$(OBJEXT) .lo
71 .c.$(OBJEXT):
72         $(COMPILE) -c $<
73 .c.lo:
74         $(LTCOMPILE) -c -o $@ $<
75 ]])
77 AT_DATA([hello.c],
78 [[#include <stdio.h>
80 void
81 hello (void)
83   printf ("** This is not GNU Hello.  There is no built-in mail reader. **\n");
85 ]])
87 AT_DATA([main.c],
88 [[#include <stdio.h>
90 extern void hello (void);
92 int
93 main (void)
95   printf ("Welcome to GNU Hell!\n");
97   hello ();
99   return 0;
103 cat > missing <<_EOF
104 #! /bin/sh
105 exit 0
106 _EOF
107 chmod a+x missing
109 LT_AT_LIBTOOLIZE([--copy --verbose --install])
110 LT_AT_ACLOCAL([-I m4])
111 LT_AT_AUTOCONF([--force])
112 LT_AT_CONFIGURE
113 LT_AT_MAKE
115 LT_AT_EXEC_CHECK([./hell], [0], [stdout])
116 AT_CHECK([$GREP 'Welcome to GNU Hell' stdout], [], [ignore])
117 AT_CHECK([$GREP 'This is not GNU Hello.' stdout],
118          [], [ignore])
120 AT_CLEANUP
123 ## ------------------------------------------ ##
124 ## Building and using libtool from config.lt. ##
125 ## ------------------------------------------ ##
127 AT_SETUP([config.lt])
129 AT_DATA([configure.ac],
130 [[AC_INIT([libtool-demo], ]]AT_PACKAGE_VERSION[[, ]]AT_PACKAGE_BUGREPORT[[)
131 AC_CONFIG_MACRO_DIRS([m4])
132 LT_INIT
133 LT_OUTPUT
135 cat >hello.c <<\_EOF
136 #include <stdio.h>
138 void
139 hello (void)
141   printf ("** This is not GNU Hello.  There is no built-in mail reader. **\n");
143 _EOF
145 # Prove that we can run libtool from inside configure:
146 $SHELL ./libtool --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS \
147     -I. -I$srcdir -c -o hello.lo hello.c  || exit 1
148 $SHELL ./libtool --mode=link --tag=CC $CC $CFLAGS $LDFLAGS \
149     -o libhello.la -rpath /notexist hello.lo || exit 1
151 AC_CONFIG_FILES([Makefile])
152 AC_OUTPUT
155 AT_DATA([Makefile.in],
156 [[prefix = @prefix@
157 libdir = @libdir@
158 top_builddir = .
159 SHELL = @SHELL@
160 DEFAULT_INCLUDES = -I. -I@srcdir@
161 EXEEXT = @EXEEXT@
162 LIBTOOL = @LIBTOOL@
163 OBJEXT = @OBJEXT@
165 CPPFLAGS = @CPPFLAGS@
166 CFLAGS = @CFLAGS@
167 LDFLAGS = @LDFLAGS@
169 COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFAULT_INCLUDES)
170 LINK = $(LIBTOOL) --mode=link --tag=CC $(CC) $(CFLAGS) $(LDFLAGS) -o $@
172 all: hell$(EXEEXT)
174 hell$(EXEEXT): main.$(OBJEXT) libhello.la
175         $(LINK) main.$(OBJEXT) libhello.la
177 .SUFFIXES:
178 .SUFFIXES: .c .$(OBJEXT)
180 .c.$(OBJEXT):
181         $(COMPILE) -c $<
184 AT_DATA([hello.c],
185 [[#include <stdio.h>
187 void
188 hello (void)
190   printf ("** This is not GNU Hello.  There is no built-in mail reader. **\n");
194 AT_DATA([main.c],
195 [[#include <stdio.h>
197 extern void hello (void);
200 main (int argc, char *argv[])
202   printf ("Welcome to GNU Hell!\n");
204   hello ();
206   return 0;
210 cat > missing <<_EOF
211 #! /bin/sh
212 exit 0
213 _EOF
214 chmod a+x missing
216 LT_AT_LIBTOOLIZE([--copy --verbose --install])
217 LT_AT_ACLOCAL([-I m4])
218 LT_AT_AUTOCONF([--force])
219 LT_AT_CONFIGURE
220 LT_AT_MAKE
222 LT_AT_EXEC_CHECK([./hell], [0], [stdout])
223 AT_CHECK([$GREP 'Welcome to GNU Hell' stdout], [], [ignore])
224 AT_CHECK([$GREP 'This is not GNU Hello.' stdout], [], [ignore])
226 # Make sure config.status --recheck updates the libtool script
227 rm libtool
228 AT_CHECK([$SHELL ./config.status --recheck],[0],[ignore],[ignore])
230 AT_CLEANUP