libtool-patches
[Top][All Lists]
Advanced

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

Re: 283-gary-test-subproject-ltdl.diff


From: Ralf Wildenhues
Subject: Re: 283-gary-test-subproject-ltdl.diff
Date: Tue, 4 Oct 2005 14:24:56 +0200
User-agent: Mutt/1.5.11

* Gary V. Vaughan wrote on Fri, Sep 30, 2005 at 12:08:24PM CEST:
> Okay to commit?

Yes, please, after addressing the nits below.

> Prevent regressions in using libltdl as a subproject.

Cheers,
Ralf

> from  Gary V. Vaughan  <address@hidden>
>       * tests/subproject.at: New tests for libltdl as a subproject with
>       its own configuration.
>       * tests/testsuite.at: Use it.
>       * 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
> @@ -473,6 +473,7 @@ TESTSUITE_AT      = tests/testsuite.at \
>                 tests/old-m4-iface.at \
>                 tests/standalone.at \
>                 tests/stresstest.at \
> +               tests/subproject.at \
>                 tests/link-order.at \
>                 tests/convenience.at \
>                 tests/early-libtool.at \
> Index: libtool--devo--1.0/tests/subproject.at
> ===================================================================
> --- /dev/null
> +++ libtool--devo--1.0/tests/subproject.at
> @@ -0,0 +1,199 @@
> +# 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., 59 Temple Place - Suite 330, Boston, MA
> +# 02111-1307, USA.
> +
> +
> +AT_BANNER([Subproject Libltdl.])
> +
> +# _LTDL_SETUP
> +# -----------
> +m4_define([_LTDL_SETUP],
> +[AT_DATA([configure.ac],
> +[[AC_INIT([subproject-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
> +LT_CONFIG_LTDL_DIR([sub/ltdl])
> +AC_CONFIG_AUX_DIR([sub/ltdl/config])
> +AC_CONFIG_MACRO_DIR([sub/ltdl/m4])
> +AM_INIT_AUTOMAKE([foreign])
> +LT_WITH_LTDL
> +LT_INIT
> +AC_CONFIG_FILES([Makefile])
> +AC_OUTPUT
> +]])
> +
> +AT_DATA([Makefile.am],
> +[[ACLOCAL_AMFLAGS = -I sub/ltdl/m4
> +SUBDIRS = sub/ltdl
> +lib_LTLIBRARIES = foo.la
> +foo_la_LDFLAGS = -module -avoid-version
> +]])
> +
> +touch foo.c
> +])# _LTDL_SETUP
> +
> +## ------------------------ ##
> +## Softlinked libltdl tree. ##
> +## ------------------------ ##
> +
> +AT_SETUP([compiling softlinked libltdl])
> +
> +_LTDL_SETUP
> +
> +LT_AT_LIBTOOLIZE([--ltdl])
> +$AUTORECONF --force --install
> +./configure
> +${MAKE-make}

Please use
  LT_AT_AUTORECONF([--force --install])
  LT_AT_CONFIGURE
  LT_AT_MAKE
if you commit after my pending testsuite update (in the thread titled
cross-compile ..), or add
  _lt_pkgdatadir="$abs_top_srcdir"
before the $AUTORECONF if you commit before me;  I can then change these
all together.

> +
> +AT_CHECK([test -f sub/ltdl/libltdlc.la])
> +
> +AT_CLEANUP
> +
> +
> +## -------------------- ##
> +## Copied libltdl tree. ##
> +## -------------------- ##
> +
> +AT_SETUP([compiling copied libltdl])
> +
> +_LTDL_SETUP
> +
> +LT_AT_LIBTOOLIZE([--copy --ltdl])
> +$AUTORECONF --force --install
> +./configure
> +${MAKE-make}

See above.

> +
> +AT_CHECK([test -f sub/ltdl/libltdlc.la])
> +
> +AT_CLEANUP
> +
> +
> +## ------------------------- ##
> +## Installable libltdl tree. ##
> +## ------------------------- ##
> +
> +AT_SETUP([installable libltdl])
> +
> +_LTDL_SETUP
> +
> +prefix=`pwd`/_inst
> +
> +LT_AT_LIBTOOLIZE([--copy --ltdl])
> +$AUTORECONF --force --install
> +./configure --enable-ltdl-install --prefix=$prefix
> +${MAKE-make} all install

See above.

> +
> +AT_CHECK([test -f $prefix/lib/libltdl.la])
> +AT_CHECK([test -f $prefix/include/ltdl.h])
> +
> +AT_CLEANUP
> +
> +
> +## ----------------------------------------------- ##
> +## libltdl is usable without Autoconf or Automake. ##
> +## ----------------------------------------------- ##
> +
> +AT_SETUP([linking libltdl without autotools])
> +
> +AT_DATA([module.c],
> +[[const char *
> +hello (void)
> +{
> +  return "Hello!";
> +}
> +]])
> +
> +AT_DATA([main.c],
> +[[#include <stdio.h>
> +#include "ltdl.h"
> +
> +int
> +main (int argc, char **argv)
> +{
> +  lt_dlhandle module;
> +  const char *(*func) (void) = 0;
> +  int status = 1;
> +
> +  LTDL_SET_PRELOADED_SYMBOLS();
> +  if (lt_dlinit() != 0) {
> +    fprintf (stderr, "error during initialisation: %s\n", lt_dlerror());
> +    return 1;
> +  }
> +
> +  module = lt_dlopen("module.la");
> +  if (!module) {
> +    fprintf (stderr, "error dlopening module.la: %s\n", lt_dlerror());
> +    goto finish;
> +  }
> +
> +  func = (const char *(*)(void)) lt_dlsym (module, "hello");
> +  if (!func) {
> +    fprintf (stderr, "error fetching func: %s\n", lt_dlerror());
> +    goto finish;
> +  }
> +
> +  printf ("%s\n", (*func) ());
> +  status = 0;
> +
> +finish:
> +  if (lt_dlexit() != 0) {
> +    fprintf (stderr, "error during finalisation: %s\n", lt_dlerror());
> +    status = 1;
> +  }
> +
> +  return status;
> +}
> +]])
> +
> +AT_DATA([Makefile],
> +[[top_builddir       = .
> +LIBTOOL              = ./sub/ltdl/libtool
> +INCLUDES     = -I./sub/ltdl
> +MODFLAGS     = -module -avoid-version -no-undefined
> +SHELL                = $(SHELL)
> +MAKE         = $(MAKE)

These two are bogus.  I don't think you can get the effect of @SET_MAKE@
without any substitutions, and the SHELL line should be superfluous.
Maybe it's sufficient if you give both on the command line (and we add
`-e' to LT_AT_MAKE for the lesser `make' implementations).

> +
> +LTCOMPILE = $(LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=compile \
> +        $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
> +LTLINK    = $(LIBTOOL) --tag=CC $(LIBTOOLFLAGS) --mode=link \
> +        $(CC) $(CFLAGS) $(LDFLAGS)
> +
> +TARGETS              = sub/ltdl/libltdlc.la module.la ltdldemo$(EXEEXT)
> +
> +all: $(TARGETS)
> +
> +$(LIBTOOL) sub/ltdl/libltdlc.la:
> +     cd sub/ltdl && ./configure && $(MAKE)

Please add CONFIGURE_OPTIONS.

> +
> +ltdldemo$(EXEEXT): $(LIBTOOL) module.la sub/ltdl/libltdlc.la main.lo
> +     $(LTLINK) -o ltdldemo main.lo -dlopen module.la ./sub/ltdl/libltdlc.la
> +
> +main.lo: $(LIBTOOL) main.c
> +     $(LTCOMPILE) -c main.c
> +
> +module.la: $(LIBTOOL) module.lo
> +     $(LTLINK) -o module.la module.lo $(MODFLAGS) -rpath /dev/null
> +
> +module.lo: $(LIBTOOL) module.c
> +     $(LTCOMPILE) -c module.c
> +]])
> +
> +LT_AT_LIBTOOLIZE([--copy --ltdl=sub/ltdl])
> +${MAKE-make} CC="$CC" LIBTOOLFLAGS="$LIBTOOLFLAGS" CPPFLAGS="$CPPFLAGS" \
> +        CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" SHELL="$SHELL" 
> MAKE="${MAKE-make}"

Please use
  LT_AT_MAKE([], [CC="$CC" ... ])
and add CONFIGURE_OPTIONS=$configure_options

> +
> +LT_AT_EXEC_CHECK([./ltdldemo], 0, [ignore])
> +
> +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
> @@ -104,6 +104,8 @@ m4_include([old-m4-iface.at])
>  m4_include([am-subdir.at])
>  # standalone libltdl compilation
>  m4_include([standalone.at])
> +# subproject libltdl compilation
> +m4_include([subproject.at])
>  # C++ templates tests
>  m4_include([template.at])
>  # Behaviour of LT_OUTPUT




reply via email to

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