[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FYI: allow running libtool tests at configure time [libtool--gary--1
From: |
Ralf Wildenhues |
Subject: |
Re: FYI: allow running libtool tests at configure time [libtool--gary--1.0--patch-26] |
Date: |
Thu, 18 Aug 2005 13:58:18 +0200 |
User-agent: |
Mutt/1.4.1i |
* Ralf Wildenhues wrote on Thu, Aug 18, 2005 at 01:56:31PM CEST:
>
> I have re-diffed this against current CVS HEAD, including changes for my
> complaints. Unless anybody complains, I will apply this soon and
> backport to branch-2-0, killing yet another impediment to 2.0. :)
And of course I have also forgotten to include tests/early-libtool.at.
Below.
Sorry,
Ralf
> * tests/early-libtool.at: New test.
--- /dev/null 2005-08-03 12:45:51.659987528 +0200
+++ tests/early-libtool.at 2005-08-18 11:43:40.000000000 +0200
@@ -0,0 +1,213 @@
+# Hand crafted tests for GNU Libtool. -*- Autotest -*-
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+
+AT_BANNER([libtool script generation.])
+
+
+## --------------------------------------------- ##
+## Building libtool normally from config.status. ##
+## --------------------------------------------- ##
+
+AT_SETUP([config.status])
+
+AT_DATA([configure.ac],
+[[AC_INIT([libtool-demo], ]]AT_PACKAGE_VERSION[[, ]]AT_PACKAGE_BUGREPORT[[)
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE
+LT_INIT
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+AT_DATA([Makefile.in],
+[[prefix = @prefix@
+libdir = @libdir@
+top_builddir = .
+DEFAULT_INCLUDES = -I. address@hidden@
+EXEEXT = @EXEEXT@
+LIBTOOL = @LIBTOOL@
+
+COMPILE = $(CC) $(DEFAULT_INCLUDES)
+LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFAULT_INCLUDES)
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CC) -o $@
+
+all: hell
+
+libhello.la: hello.lo
+ $(LINK) -rpath $(libdir) hello.lo
+hell$(EXEEXT): main.o libhello.la
+ $(LINK) main.o libhello.la
+
+.SUFFIXES:
+.SUFFIXES: .c .o .lo
+
+.c.o:
+ $(COMPILE) -c -o $@ $<
+.c.lo:
+ $(LTCOMPILE) -c -o $@ $<
+]])
+
+AT_DATA([hello.c],
+[[#include <stdio.h>
+
+void
+hello (void)
+{
+ printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
+}
+]])
+
+AT_DATA([main.c],
+[[#include <stdio.h>
+
+extern void hello (void);
+
+int
+main (int argc, char *argv[])
+{
+ printf ("Welcome to GNU Hell!\n");
+
+ hello ();
+
+ return 0;
+}
+]])
+
+AT_DATA(expout,
+[[Welcome to GNU Hell!
+** This is not GNU Hello. There is no built-in mail reader. **
+]])
+
+cat > missing <<_EOF
+#! /bin/sh
+exit 0
+_EOF
+chmod a+x missing
+
+test -f ltmain.sh || LT_AT_LIBTOOLIZE([--copy --verbose --install])
+test -f aclocal.m4 || $ACLOCAL -I m4 || exit 1
+test -f configure || $AUTOCONF --force || exit 1
+test -f Makefile || ./configure || exit 1
+${MAKE-make}
+
+LT_AT_EXEC_CHECK([./hell], [0], [expout])
+
+AT_CLEANUP
+
+
+## ------------------------------------------ ##
+## Building and using libtool from config.lt. ##
+## ------------------------------------------ ##
+
+AT_SETUP([config.lt])
+
+AT_DATA([configure.ac],
+[[AC_INIT([libtool-demo], ]]AT_PACKAGE_VERSION[[, ]]AT_PACKAGE_BUGREPORT[[)
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE
+LT_INIT
+LT_OUTPUT
+
+cat >hello.c <<\_LTEOF
+#include <stdio.h>
+
+void
+hello (void)
+{
+ printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
+}
+_LTEOF
+
+# Prove that we can run libtool from inside configure:
+$SHELL ./libtool --mode=compile --tag=CC "$CC" -I. -I$srcdir \
+ -c -o hello.lo hello.c || exit 1
+$SHELL ./libtool --mode=link --tag=CC "$CC" -o libhello.la \
+ -rpath /notexist hello.lo || exit 1
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+AT_DATA([Makefile.in],
+[[prefix = @prefix@
+libdir = @libdir@
+top_builddir = .
+DEFAULT_INCLUDES = -I. address@hidden@
+EXEEXT = @EXEEXT@
+LIBTOOL = @LIBTOOL@
+
+COMPILE = $(CC) $(DEFAULT_INCLUDES)
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CC) -o $@
+
+hell$(EXEEXT): main.o libhello.la
+ $(LINK) main.o libhello.la
+
+.SUFFIXES:
+.SUFFIXES: .c .o
+
+.c.o:
+ $(COMPILE) -c -o $@ $<
+]])
+
+AT_DATA([hello.c],
+[[#include <stdio.h>
+
+void
+hello (void)
+{
+ printf ("** This is not GNU Hello. There is no built-in mail reader. **\n");
+}
+]])
+
+AT_DATA([main.c],
+[[#include <stdio.h>
+
+extern void hello (void);
+
+int
+main (int argc, char *argv[])
+{
+ printf ("Welcome to GNU Hell!\n");
+
+ hello ();
+
+ return 0;
+}
+]])
+
+AT_DATA(expout,
+[[Welcome to GNU Hell!
+** This is not GNU Hello. There is no built-in mail reader. **
+]])
+
+cat > missing <<_EOF
+#! /bin/sh
+exit 0
+_EOF
+chmod a+x missing
+
+test -f ltmain.sh || LT_AT_LIBTOOLIZE([--copy --verbose --install])
+test -f aclocal.m4 || $ACLOCAL -I m4 || exit 1
+test -f configure || $AUTOCONF --force || exit 1
+test -f Makefile || ./configure || exit 1
+${MAKE-make}
+
+LT_AT_EXEC_CHECK([./hell], [0], [expout])
+
+AT_CLEANUP