From 48b731bc0b64f327e630e67b4dc2a69756a5ced4 Mon Sep 17 00:00:00 2001 From: Greg Eisenhauer Date: Thu, 31 Jul 2003 20:46:41 +0000 Subject: [PATCH] * ltmain.in: Provide absolute paths for dlopen and dlpreopen files in generating uninstalled libtool libraries. * mdemo2/main.c, mdemo2/Makefile.am, mdemo2/README, mdemo2/configure.ac, mdemo2/.cvsignore, mdemo/mlib.c, tests/mdemo2-conf.test, tests/mdemo2-exec.test, tests/mdemo2-make.test: New files for testing above feature. * configure.ac, bootstrap, tests/Makefile.am: Accomodate new test directory. * mdemo/Makefile.am: Build libmlib.la for mdemo2 tests. --- ChangeLog | 12 ++++++++ bootstrap | 2 +- configure.ac | 2 +- ltmain.in | 19 ++++++++++++ mdemo/Makefile.am | 7 ++++- mdemo2/.cvsignore | 15 ++++++++++ mdemo2/Makefile.am | 24 ++++++++++++++++ mdemo2/README | 5 ++++ mdemo2/configure.ac | 70 +++++++++++++++++++++++++++++++++++++++++++++ mdemo2/main.c | 39 +++++++++++++++++++++++++ tests/Makefile.am | 5 +++- 11 files changed, 196 insertions(+), 4 deletions(-) create mode 100644 mdemo2/.cvsignore create mode 100644 mdemo2/Makefile.am create mode 100644 mdemo2/README create mode 100644 mdemo2/configure.ac create mode 100644 mdemo2/main.c diff --git a/ChangeLog b/ChangeLog index b05fe05c7..4c1d33ed3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2003-07-31 Greg Eisenhauer + + * ltmain.in: Provide absolute paths for dlopen and dlpreopen + files in generating uninstalled libtool libraries. + * mdemo2/main.c, mdemo2/Makefile.am, mdemo2/README, + mdemo2/configure.ac, mdemo2/.cvsignore, mdemo/mlib.c, + tests/mdemo2-conf.test, tests/mdemo2-exec.test, + tests/mdemo2-make.test: New files for testing above feature. + * configure.ac, bootstrap, tests/Makefile.am: Accomodate new + test directory. + * mdemo/Makefile.am: Build libmlib.la for mdemo2 tests. + 2003-07-30 Tony Wyatt * libtool.m4: Remove parentheses around finish_eval part which diff --git a/bootstrap b/bootstrap index c9d9a80dc..304284fc0 100755 --- a/bootstrap +++ b/bootstrap @@ -15,7 +15,7 @@ touch ltmain.sh touch libtoolize (cd libltdl && touch ltmain.sh) -for sub in . libltdl cdemo demo depdemo mdemo pdemo tagdemo f77demo; do +for sub in . libltdl cdemo demo depdemo mdemo mdemo2 pdemo tagdemo f77demo; do case $sub in .) top_srcdir=. diff --git a/configure.ac b/configure.ac index 1ccfb621a..938580351 100644 --- a/configure.ac +++ b/configure.ac @@ -74,7 +74,7 @@ AC_CONFIG_SUBDIRS([libltdl]) # all subdirectories that are configured on demand, but that must be # included in the distribution -CONF_SUBDIRS="cdemo pdemo demo depdemo mdemo tagdemo f77demo" +CONF_SUBDIRS="cdemo pdemo demo depdemo mdemo mdemo2 tagdemo f77demo" AC_SUBST([CONF_SUBDIRS]) ACINCLUDE_M4_LIST="${srcdir}/acinclude.m4" diff --git a/ltmain.in b/ltmain.in index 7ff31df19..5065415c3 100644 --- a/ltmain.in +++ b/ltmain.in @@ -5111,6 +5111,25 @@ fi\ newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin diff --git a/mdemo/Makefile.am b/mdemo/Makefile.am index 2141e0d2f..8136c4351 100644 --- a/mdemo/Makefile.am +++ b/mdemo/Makefile.am @@ -6,7 +6,7 @@ INCLUDES = $(INCLTDL) EXTRA_DIST = acinclude.m4 -lib_LTLIBRARIES = libsub.la foo1.la libfoo2.la +lib_LTLIBRARIES = libsub.la foo1.la libfoo2.la libmlib.la foo1_la_SOURCES = foo1.c foo1_la_LIBADD = $(LIBM) libsub.la @@ -19,6 +19,11 @@ libfoo2_la_LDFLAGS = -no-undefined -module -export-symbols-regex "libfoo2.*" libsub_la_SOURCES = sub.c libsub_la_LDFLAGS = -no-undefined +libmlib_la_SOURCES = mlib.c +libmlib_la_LIBADD = @LIBLTDL@ "-dlopen" foo1.la "-dlopen" libfoo2.la +libmlib_la_LDFLAGS = -no-undefined +libmlib_la_DEPENDENCIES = @LIBLTDL@ libsub.la foo1.la libfoo2.la + noinst_HEADERS = foo.h bin_PROGRAMS = mdemo mdemo_static diff --git a/mdemo2/.cvsignore b/mdemo2/.cvsignore new file mode 100644 index 000000000..b987e2ce1 --- /dev/null +++ b/mdemo2/.cvsignore @@ -0,0 +1,15 @@ +.deps +.libs +Makefile +Makefile.in +acinclude.m4 +aclocal.m4 +configure +config.* +conftest* +libtool +*.lo +*.la +mdemo2 +mdemo2_static +mdemo2.static diff --git a/mdemo2/Makefile.am b/mdemo2/Makefile.am new file mode 100644 index 000000000..332949535 --- /dev/null +++ b/mdemo2/Makefile.am @@ -0,0 +1,24 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = no-dependencies foreign + +INCLUDES = $(INCLTDL) + +EXTRA_DIST = acinclude.m4 + +bin_PROGRAMS = mdemo2 mdemo2_static + +# Create a version of mdemo2 that links a library that does dlopen. +mdemo2_SOURCES = main.c +mdemo2_LDFLAGS = -export-dynamic +mdemo2_LDADD = ../mdemo/libmlib.la + +# Create a statically linked version of mdemo. +mdemo2_static_SOURCES = $(mdemo2_SOURCES) +mdemo2_static_LDFLAGS = $(STATIC) $(mdemo2_LDFLAGS) +mdemo2_static_LDADD = $(mdemo2_LDADD) +mdemo2_static_DEPENDENCIES = $(mdemo2_DEPENDENCIES) + +$(OBJECTS): libtool +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck diff --git a/mdemo2/README b/mdemo2/README new file mode 100644 index 000000000..8a1e18ba8 --- /dev/null +++ b/mdemo2/README @@ -0,0 +1,5 @@ +This is mdemo2, an example package that attempts to use GNU libtool to +link with a library that itself does dlopening of libtool modules. + +This demo depends upon the libraries generated in ../mdemo. + diff --git a/mdemo2/configure.ac b/mdemo2/configure.ac new file mode 100644 index 000000000..9f7b3fd26 --- /dev/null +++ b/mdemo2/configure.ac @@ -0,0 +1,70 @@ +## Process this file with autoconf to create configure. -*- autoconf -*- +# Copyright 2001 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 of the License, 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 + +AC_PREREQ(2.50) + + +## ------------------------ ## +## Autoconf initialisation. ## +## ------------------------ ## +AC_INIT([mdemo2], [0.1], [bug-libtool@gnu.org]) +AC_CONFIG_SRCDIR([main.c]) + + +## ------------------------ ## +## Automake Initialisation. ## +## ------------------------ ## +AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION) + + +## ------------------ ## +## C compiler checks. ## +## ------------------ ## +AC_PROG_CC +AC_C_CONST + + +## ----------------------- ## +## Libtool initialisation. ## +## ----------------------- ## +AM_PROG_LIBTOOL +AC_SUBST(LIBTOOL_DEPS) + +if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then + STATIC=-static +else + STATIC= +fi +AC_SUBST([STATIC]) + + +## ---------------------------- ## +## C headers required by mdemo2. ## +## ---------------------------- ## + + +## ---------------------------- ## +## Libraries required by cdemo. ## +## ---------------------------- ## + + +## -------- ## +## Outputs. ## +## -------- ## +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/mdemo2/main.c b/mdemo2/main.c new file mode 100644 index 000000000..b6bd75a0e --- /dev/null +++ b/mdemo2/main.c @@ -0,0 +1,39 @@ +/* main.c -- mdemo2 test program + Copyright (C) 2003 Free Software Foundation, Inc. + Originally by Greg Eisenhauer < eisen at cc.gatech.edu > + This file is part of GNU Libtool. + +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 of the License, 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. */ + +#include + +int +main (argc, argv) + int argc; + char **argv; +{ + int ret = 0; + + printf ("Welcome to GNU libtool mdemo2!\n"); + + if (argc < 2) { + fprintf (stderr, "usage: %s module [module...]\n", argv[0]); + } + + ret = mlib_func(argc, argv); + + return ret; +} diff --git a/tests/Makefile.am b/tests/Makefile.am index 51a3a8c77..ab3c34bfd 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -43,7 +43,10 @@ COMMON_TESTS = \ mdemo-inst.test mdemo-unst.test \ assign.test link.test link-2.test nomode.test \ quote.test sh.test suffix.test pdemo-conf.test \ - pdemo-make.test pdemo-exec.test pdemo-inst.test + pdemo-make.test pdemo-exec.test pdemo-inst.test \ + mdemo-conf.test mdemo-make.test mdemo2-conf.test \ + mdemo2-make.test mdemo2-exec.test + if HAVE_CXX if HAVE_F77 -- 2.47.3