libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

280-gary-test-old-m4-interface.diff


From: Gary V. Vaughan
Subject: 280-gary-test-old-m4-interface.diff
Date: Thu, 29 Sep 2005 15:35:37 +0100
User-agent: quilt/0.42-1

Okay to commit?

Make a start at a test group for checking that backwards compatibility
with configure.in calls to our old m4 interface does not regress.

 Makefile.am           |    1
 tests/old-m4-iface.at |  179 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/testsuite.at    |    6 +
 3 files changed, 185 insertions(+), 1 deletion(-)

Index: libtool--devo--1.0/ChangeLog
from  Gary V. Vaughan  <address@hidden>
        * tests/old-m4-iface.at: Start of a new test series for m4
        interface backwards compatibility.
        * tests/testsuite.at: Use it.
        (macrodir): Declare the location of uninstalled libtool m4 macros.
        * Makefile.am (TESTSUITE_AT): Depend on it.

Index: libtool--devo--1.0/Makefile.am
===================================================================
--- libtool--devo--1.0.orig/Makefile.am
+++ libtool--devo--1.0/Makefile.am
@@ -470,6 +470,7 @@ TESTSUITE_AT        = tests/testsuite.at \
                  tests/duplicate_members.at \
                  tests/inherited_flags.at \
                  tests/libtoolize.at \
+                 tests/old-m4-iface.at \
                  tests/standalone.at \
                  tests/stresstest.at \
                  tests/link-order.at \
Index: libtool--devo--1.0/tests/old-m4-iface.at
===================================================================
--- /dev/null
+++ libtool--devo--1.0/tests/old-m4-iface.at
@@ -0,0 +1,179 @@
+# 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([Support for older m4 interface.])
+
+########################################################################
+##
+## TODO:
+##   test all the interfaces currently supported by AU_DEFUN/AU_ALIAS
+##   test autoupdate on all of those tests' configure.in
+##
+########################################################################
+
+## -------------------------------------------------------- ##
+## An overtly simple old-school AC_PROG_LIBTOOL invocation. ##
+## -------------------------------------------------------- ##
+
+AT_SETUP([AC_PROG_LIBTOOL])
+
+AT_DATA([configure.in],
+[[AC_INIT(old.c)
+AC_PROG_LIBTOOL
+AC_OUTPUT(Makefile)
+]])
+
+AT_DATA([Makefile.in],
+[[COMPILE = @CC@ @CPPFLAGS@ @CFLAGS@
+LINK = @CC@ @CFLAGS@ @LDFLAGS@ -o $@
+
+all: address@hidden@
+
address@hidden@: address@hidden@
+       $(LINK) address@hidden@
+
address@hidden@:
+       $(COMPILE) -c $<
+]])
+
+
+AT_DATA([old.c],
+[[#include <stdio.h>
+
+int main (int argc, char **argv)
+{
+  printf ("Hello, World!");
+  return 0;
+}
+]])
+
+test -f ltmain.sh  || LT_AT_LIBTOOLIZE([--install])
+
+# This is slightly bogus, since only libtool.m4 was required in aclocal.m4
+# with libtool-1.5x...
+test -f aclocal.m4 \
+    || cat "$macrodir/libtool.m4" "$macrodir/ltoptions.m4" \
+       "$macrodir/ltsugar.m4" "$macrodir/ltversion.m4" > aclocal.m4 \
+    || exit 1
+
+test -f configure  || $AUTOCONF --force || exit 1
+test -f Makefile   || ./configure       || exit 1
+${MAKE-make}
+
+LT_AT_EXEC_CHECK([./old], 0, [Hello, World!])
+
+AT_CLEANUP
+
+
+## --------------------------- ##
+## An old style libltdl build. ##
+## --------------------------- ##
+
+AT_SETUP([AC_WITH_LTDL])
+
+AT_DATA([configure.in],
+[[AC_INIT(old.c)
+AC_PROG_LIBTOOL
+AC_WITH_LTDL
+AC_OUTPUT(Makefile)
+]])
+
+AT_DATA([Makefile.in],
+[[INCLUDES = -I./libltdl
+COMPILE    = @CC@ @CPPFLAGS@ $(INCLUDES) @CFLAGS@
+LTCOMPILE  = @LIBTOOL@ --mode=compile $(COMPILE)
+LTLINK     = @LIBTOOL@ --mode=link @CC@ @CFLAGS@ @LDFLAGS@ -o $@
+
+TARGETS    = libltdl/libltdlc.la module.la address@hidden@
+
+all: $(TARGETS)
+
+libltdl/libltdlc.la:
+       cd libltdl && ./configure && $(MAKE)
+
+module.la: module.lo
+       $(LTLINK) module.lo -rpath /dev/null
+
address@hidden@: address@hidden@
+       $(LTLINK) address@hidden@ -dlopen module.la ./libltdl/libltdlc.la
+
address@hidden@:
+       $(COMPILE) -c $<
+
+.c.lo:
+       $(LTCOMPILE) -c -o $@ $<
+]])
+
+AT_DATA([old.c],
+[[#include <stdio.h>
+#include "ltdl.h"
+
+int main (int argc, char **argv)
+{
+  lt_dlhandle module;
+  const char *(*foo) (const char *) = 0;
+  int status = 1;
+
+  LTDL_SET_PRELOADED_SYMBOLS();
+  if (lt_dlinit() != 0) {
+    fprintf (stderr, "error during initialisation: %s\n", lt_dlerror());
+    return 1;
+  }
+
+  handle = lt_dlopen("module.la");
+  if (!module) {
+    fprintf (stderr, "error dlopening module.la: %s\n", lt_dlerror());
+    goto finish;
+  }
+
+  foo = (const char *(*)(const char *)) lt_dlsym (module, "foo");
+  if (!foo) {
+    fprintf (stderr, "error fetching func: %s\n", lt_dlerror());
+    goto finish;
+  }
+
+  printf ("%s\n", (*foo) ("foo bar"));
+  status = 0;
+
+finish:
+  lt_dlexit();
+
+  return status;
+}
+]])
+
+AT_DATA([module.c],
+[[const char *
+foo (const char *str)
+{
+  while (*str++ != ' ')
+    ;
+  return str;
+}
+]])
+
+test -f ltmain.sh  || LT_AT_LIBTOOLIZE([--ltdl --install])
+test -f aclocal.m4 || $ACLOCAL          || exit 1
+test -f configure  || $AUTOCONF --force || exit 1
+test -f Makefile   || ./configure       || exit 1
+${MAKE-make}
+
+LT_AT_EXEC_CHECK([./old], 0, [bar])
+
+AT_CLEANUP
Index: libtool--devo--1.0/tests/testsuite.at
===================================================================
--- libtool--devo--1.0.orig/tests/testsuite.at
+++ libtool--devo--1.0/tests/testsuite.at
@@ -22,9 +22,11 @@ m4_divert_push([PREPARE_TESTS])dnl
 : ${LIBTOOLIZE="${abs_top_builddir}/libtoolize"}
 : ${LIBTOOL="${abs_top_builddir}/libtool"}
 : ${ACLOCAL=aclocal}
+: ${AUTOHEADER=autoheader}
 : ${AUTOCONF=autoconf}
 : ${AUTORECONF=autoreconf}
-export LIBTOOLIZE LIBTOOL ACLOCAL AUTOCONF AUTORECONF
+export LIBTOOLIZE LIBTOOL ACLOCAL AUTOHEADER AUTOCONF AUTORECONF
+macrodir="$abs_top_srcdir/libltdl/m4"
 eval `$LIBTOOL --config | grep ^EGREP=`
 eval `$LIBTOOL --config | $EGREP '^(host|host_os|build)='`
 m4_divert_pop([PREPARE_TESTS])dnl
@@ -96,6 +98,8 @@ m4_include([inherited_flags.at])
 m4_include([convenience.at])
 # link order test
 m4_include([link-order.at])
+# Ensure our continued support for old interfaces.
+m4_include([old-m4-iface.at])
 # Torturing subdir-objects builds
 m4_include([am-subdir.at])
 # standalone libltdl compilation
-- 
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook




reply via email to

[Prev in Thread] Current Thread [Next in Thread]