1 # early-libtool.at -- early libtool script generation -*- Autotest -*-
3 # Copyright (C) 2005-2008, 2011-2019, 2021-2024 Free Software
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.
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])
39 AC_CONFIG_FILES([Makefile])
43 AT_DATA([Makefile.in],
48 DEFAULT_INCLUDES = -I. -I@srcdir@
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 $@
64 $(LINK) -rpath $(libdir) hello.lo
65 hell$(EXEEXT): main.$(OBJEXT) libhello.la
66 $(LINK) main.$(OBJEXT) libhello.la
69 .SUFFIXES: .c .$(OBJEXT) .lo
74 $(LTCOMPILE) -c -o $@ $<
83 printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
90 extern void hello (void);
95 printf ("Welcome to GNU Hell!\n");
109 LT_AT_LIBTOOLIZE([--copy --verbose --install])
110 LT_AT_ACLOCAL([-I m4])
111 LT_AT_AUTOCONF([--force])
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],
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])
141 printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
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])
155 AT_DATA([Makefile.in],
160 DEFAULT_INCLUDES = -I. -I@srcdir@
165 CPPFLAGS = @CPPFLAGS@
169 COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFAULT_INCLUDES)
170 LINK = $(LIBTOOL) --mode=link --tag=CC $(CC) $(CFLAGS) $(LDFLAGS) -o $@
174 hell$(EXEEXT): main.$(OBJEXT) libhello.la
175 $(LINK) main.$(OBJEXT) libhello.la
178 .SUFFIXES: .c .$(OBJEXT)
190 printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
197 extern void hello (void);
200 main (int argc, char *argv[])
202 printf ("Welcome to GNU Hell!\n");
216 LT_AT_LIBTOOLIZE([--copy --verbose --install])
217 LT_AT_ACLOCAL([-I m4])
218 LT_AT_AUTOCONF([--force])
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
228 AT_CHECK([$SHELL ./config.status --recheck],[0],[ignore],[ignore])