libtool-patches
[Top][All Lists]
Advanced

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

283-gary-test-subproject-ltdl.diff


From: Gary V. Vaughan
Subject: 283-gary-test-subproject-ltdl.diff
Date: Fri, 30 Sep 2005 11:08:24 +0100
User-agent: quilt/0.42-1

Okay to commit?

Prevent regressions in using libltdl as a subproject.

 Makefile.am         |    1 
 tests/subproject.at |  199 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/testsuite.at  |    2 
 3 files changed, 202 insertions(+)

Index: libtool--devo--1.0/ChangeLog
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}
+
+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}
+
+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
+
+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)
+
+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)
+
+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}"
+
+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
-- 
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]