libtool-patches
[Top][All Lists]
Advanced

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

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


From: Ralf Wildenhues
Subject: Re: 280-gary-test-old-m4-interface.diff
Date: Thu, 29 Sep 2005 17:16:25 +0200
User-agent: Mutt/1.5.11

Hi Gary,

* Gary V. Vaughan wrote on Thu, Sep 29, 2005 at 04:35:37PM CEST:
> Okay to commit?

This one is much easier to review, so I'll do it first..

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

Nits below inline.  If you like, you can install after addressing them.

One general comment:
I noted that Autotest actually doesn't like _any_ failures outside of
AT_CHECK.  We have this wrong in several tests: basically all the
  command || exit 1
are wrong; I can change all to be like 
  AT_CHECK([command], 0, [ignore], [ignore])
in one patch if you like, so don't bother fixing only these in this one.

Thank you!

Cheers,
Ralf

>  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

old would be: AM_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 $<

Need:
- SHELL = @SHELL@ 
- setting of .SUFFIXES
- adding of -no-undefined on w32

> +]])
> +
> +
> +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)

Need:
- configure options as in my pending cross-compile patch (whoever
  merges last gets to adjust :)
- @SET_MAKE@ and AC_PROG_MAKE_SET
- .SUFFIXES

> +
> +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();

You could check the exit status of 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

This aclocal call needs an -I to find our new macros.  Here, it barfs
with
| configure.in:2: error: possibly undefined macro: AC_PROG_LIBTOOL
|       If this token and others are legitimate, please use m4_pattern_allow.
|       See the Autoconf documentation.
| configure.in:3: error: possibly undefined macro: AC_WITH_LTDL

because I do not have any libtool.m4 in the default aclocal search path
(which is nice for testing ;-).

> +test -f configure  || $AUTOCONF --force || exit 1
> +test -f Makefile   || ./configure       || exit 1

Same configure options issue as above.

> +${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




reply via email to

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