libtool-patches
[Top][All Lists]
Advanced

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

Partial linking of .lo objects, rev 2 (CVS HEAD)


From: Marc Alff
Subject: Partial linking of .lo objects, rev 2 (CVS HEAD)
Date: Sun, 09 Apr 2006 09:10:35 -0700
User-agent: Mozilla Thunderbird 1.0.7 (X11/20060327)


Hi Ralf and all.

Trying again with reloadables ...

This patch (still proposed) is ...
- based on CVS HEAD,
- takes into account all the comments to date,
- defines functional tests (compile, link, inspect the resulting binary)
- uses Autotest

What changed :

2006-04-09  Marc Alff  <address@hidden>

* libltdl/config/ltmain.m4sh (link mode) <reload_cmds>: Fixed generated commands
   when performing partial link against libtool objects (*.lo).
   * tests/reloc-objext.at: new test.
   * tests/reloc-objext-conv.at: new test.
   * tests/reloc-objext-lib.at: new test.
   * tests/reloc-libtool.at: new test.
   * tests/reloc-libtool-shared.at: new test.
   * tests/reloc-libtool-static.at: new test.
   * tests/reloc-libtool-conv.at: new test.
   * tests/reloc-libtool-conv-shared.at: new test.
   * tests/reloc-libtool-conv-static.at: new test.
   * tests/reloc-errors.at: new test.
   * Makefile.am: adjust.
   Bug reported by Ralf Wildenhues <address@hidden>,
   patch by Marc Alff <address@hidden>.

The following configurations were used for the new tests,
which are executed or skipped as appropriate :

1)
$LIBTOOL --features
enable shared libraries
enable static libraries

2)
$LIBTOOL --features
disable shared libraries
enable static libraries

3)
$LIBTOOL --features
enable shared libraries
disable static libraries

The code change in ltmain.m4sh is localized to the <reload_cmds> area,
but is more extensive, so the diff will probably be real hard to read.

All the parts that needs special review are commented with the keyword "REVIEW-ME",
to facilitate inspection.

I suggest to start with the tests, to make sure the correct behavior is defined, and look at the code after (since the code complies with the tests, and the tests reflect my
possibly incorrect understanding of details).

I am sure it's not perfect yet, and that you will find things i missed (or don't know about),
but I think it's getting there :)

Cheers,
Marc.



diff -Naur libtool/Makefile.am libtool-reloc/Makefile.am
--- libtool/Makefile.am 2006-03-20 20:46:30.000000000 +0000
+++ libtool-reloc/Makefile.am   2006-04-09 15:57:40.000000000 +0000
@@ -399,7 +399,17 @@
                  tests/template.at \
                  tests/early-libtool.at \
                  tests/deplibs-ident.at \
-                 tests/stresstest.at
+                 tests/stresstest.at \
+                 tests/reloc-objext.at \
+                 tests/reloc-objext-conv.at \
+                 tests/reloc-objext-lib.at \
+                 tests/reloc-libtool.at \
+                 tests/reloc-libtool-static.at \
+                 tests/reloc-libtool-shared.at \
+                 tests/reloc-libtool-conv.at \
+                 tests/reloc-libtool-conv-static.at \
+                 tests/reloc-libtool-conv-shared.at \
+                 tests/reloc-errors.at
 
 EXTRA_DIST     += $(srcdir)/$(TESTSUITE) $(TESTSUITE_AT) 
$(srcdir)/tests/package.m4
 
diff -Naur libtool/libltdl/config/ltmain.m4sh 
libtool-reloc/libltdl/config/ltmain.m4sh
--- libtool/libltdl/config/ltmain.m4sh  2006-03-20 20:40:07.000000000 +0000
+++ libtool-reloc/libltdl/config/ltmain.m4sh    2006-04-09 15:57:40.000000000 
+0000
@@ -5462,39 +5462,79 @@
        fi
       fi
 
-      # Create the old-style object.
-      reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e 
'/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### 
testsuite: skip nested quoting test
-
-      output="$obj"
-      func_execute_cmds "$reload_cmds" 'exit $?'
+## REVIEW-ME ============================================ (begin)
+##
+## Important note (found by code review)
+## During the parsing of the *.lo files,
+## - $libobjs is used to cummulate all the PIC entries (using non-PIC as a 
backup),
+## - $non_pic_objects is used to cummulate all the non-PIC entries (using PIC 
as a backup).
+## The variables names are deceiving.
+##
+## As a result :
+## - linking a non-PIC result should use $non_pic_objects,
+## - linking a PIC result should use $libobjs,
+## 
+
+      non_pic_object_to_print="none"
+
+      if test "$build_old_libs" = yes; then
+         # Create the old-style object.
+         ## previous code, delete after review : 
reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e 
'/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### 
testsuite: skip nested quoting test
+
+         # remove spurious *.a *.dll *.lib
+         # rename *.lo to *.o
+         clean_non_pic_objects=`$ECHO "X$non_pic_objects" | $SP2NL | $Xsed -e 
'/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
+
+         reload_objs="$objs$old_deplibs $clean_non_pic_objects 
$reload_conv_objs"
+
+         output="$obj"
+         non_pic_object_to_print="'$output'"
+         func_execute_cmds "$reload_cmds" 'exit $?'
+      fi
 
-      # Exit if we aren't doing a library object file.
+      # Exit if we aren't doing a libtool object file.
       if test -z "$libobj"; then
-       if test -n "$gentop"; then
-         func_show_eval '${RM}r "$gentop"'
-       fi
+         if test -n "$gentop"; then
+            func_show_eval '${RM}r "$gentop"'
+         fi
 
-       exit $EXIT_SUCCESS
+         exit $EXIT_SUCCESS
       fi
 
-      if test "$build_libtool_libs" != yes; then
-       if test -n "$gentop"; then
-         func_show_eval '${RM}r "$gentop"'
-       fi
+      pic_object_to_print="none"
 
-       # Create an invalid libtool object if no PIC, so that we don't
-       # accidentally link it into a program.
-       # $show "echo timestamp > $libobj"
-       # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
-       exit $EXIT_SUCCESS
+      if test "$build_libtool_libs" = yes; then
+         if test -n "$pic_flag" || test "$pic_mode" != default; then
+            # Only do commands if we really have different PIC objects.
+            reload_objs="$libobjs $reload_conv_objs"
+            output="$objdir/$obj"
+            pic_object_to_print="'$output'"
+            func_execute_cmds "$reload_cmds" 'exit $?'
+         fi
       fi
 
-      if test -n "$pic_flag" || test "$pic_mode" != default; then
-       # Only do commands if we really have different PIC objects.
-       reload_objs="$libobjs $reload_conv_objs"
-       output="$libobj"
-       func_execute_cmds "$reload_cmds" 'exit $?'
-      fi
+    $opt_dry_run || $RM "$libobj"
+
+    func_echo "creating libtool object \`${libobj}'"
+
+    # Create a libtool object file (analogous to a ".la" file),
+    # but don't create it if we're doing a dry run.
+    $opt_dry_run || cat > ${libobj} <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the libtool object.
+
+# Name of the PIC object.
+pic_object=$pic_object_to_print
+
+# Name of the non-PIC object
+non_pic_object=$non_pic_object_to_print
+
+EOF
+
+## REVIEW-ME ============================================ (end)
 
       if test -n "$gentop"; then
        func_show_eval '${RM}r "$gentop"'
diff -Naur libtool/tests/reloc-errors.at libtool-reloc/tests/reloc-errors.at
--- libtool/tests/reloc-errors.at       1970-01-01 00:00:00.000000000 +0000
+++ libtool-reloc/tests/reloc-errors.at 2006-04-09 15:57:40.000000000 +0000
@@ -0,0 +1,55 @@
+# Hand crafted tests for GNU Libtool.                         -*- Autotest -*-
+# Copyright 2006 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.
+
+# reloc-errors.at - testing partial linking (invalid uses)
+# Written by Marc Alff
+
+AT_SETUP([Reloc objext errors])
+AT_KEYWORDS([libtool])
+LDFLAGS=""
+
+## Can not link an *.$OBJEXT into a *.lo
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $LDFLAGS -o all.lo wrong.$OBJEXT],
+   [1],
+   [ignore],
+   [stderr])
+
+AT_CHECK(
+   [grep "cannot build library object .all\.lo. from non-libtool objects" 
stderr],
+   [0],
+   [ignore],
+   [ignore])
+
+## Can not link an *.a into a *.lo
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $LDFLAGS -o all.lo wrong.a],
+   [1],
+   [ignore],
+   [stderr])
+
+AT_CHECK(
+   [grep "cannot build library object .all\.lo. from non-libtool objects" 
stderr],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CLEANUP
+
diff -Naur libtool/tests/reloc-libtool-conv-shared.at 
libtool-reloc/tests/reloc-libtool-conv-shared.at
--- libtool/tests/reloc-libtool-conv-shared.at  1970-01-01 00:00:00.000000000 
+0000
+++ libtool-reloc/tests/reloc-libtool-conv-shared.at    2006-04-09 
15:57:40.000000000 +0000
@@ -0,0 +1,183 @@
+# Hand crafted tests for GNU Libtool.                         -*- Autotest -*-
+# Copyright 2006 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.
+
+# reloc-libtool-conv-shared.at - testing partial linking of libtool objects 
(convenience, shared)
+# Written by Marc Alff
+
+AT_SETUP([Reloc libtool convenience shared])
+AT_KEYWORDS([libtool])
+LDFLAGS=""
+
+## Design notes
+## ============
+#
+# This test requires :
+# - "enable shared libraries"
+
+AT_CHECK(
+   [($LIBTOOL --features | grep "enable shared libraries" ) || exit 77],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_DATA(a.c,
+[[
+extern void foo_a() {}
+extern const char* str_a ;
+const char* str_a = "The content of a.c is in here.\n" ;
+extern const char* pic_a ;
+const char* pic_a = "A: "
+#ifdef PIC
+   "PIC defined"
+#else
+   "PIC not defined"
+#endif
+   ;
+]])
+
+AT_DATA(b.c,
+[[
+extern void foo_b() {}
+extern const char* str_b ;
+const char* str_b = "The content of b.c is in here.\n" ;
+]])
+
+AT_DATA(c.c,
+[[
+extern void foo_c() {}
+extern const char* str_c ;
+const char* str_c = "The content of c.c is in here.\n" ;
+extern const char* pic_c ;
+const char* pic_c = "C: "
+#ifdef PIC
+   "PIC defined"
+#else
+   "PIC not defined"
+#endif
+   ;
+]])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -shared -c a.c -o a.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -shared -c b.c -o b.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -shared -c c.c -o c.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $LDFLAGS -shared -o libconv.la c.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+# Linking *.lo objects, with -shared, with a convenience library
+# libconv.la should be added in the result.
+# expecting a *.lo to be created, with a PIC only.
+
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -shared -o all.lo a.lo b.lo 
libconv.la],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify all.$OBJEXT is not created
+
+AT_CHECK(
+   [! test -f all.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify .libs/all.o
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "The content of a\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "The content of b\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "The content of c\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM .libs/all.$OBJEXT | grep "foo_a"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM .libs/all.$OBJEXT | grep "foo_b"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM .libs/all.$OBJEXT | grep "foo_c"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "A: PIC defined"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "C: PIC defined"],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify all.lo
+
+AT_CHECK(
+   [cat all.lo | grep "^non_pic_object=none"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [cat all.lo | grep "^pic_object='\.libs/all.$OBJEXT'"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CLEANUP
+
diff -Naur libtool/tests/reloc-libtool-conv-static.at 
libtool-reloc/tests/reloc-libtool-conv-static.at
--- libtool/tests/reloc-libtool-conv-static.at  1970-01-01 00:00:00.000000000 
+0000
+++ libtool-reloc/tests/reloc-libtool-conv-static.at    2006-04-09 
15:57:40.000000000 +0000
@@ -0,0 +1,182 @@
+# Hand crafted tests for GNU Libtool.                         -*- Autotest -*-
+# Copyright 2006 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.
+
+# reloc-libtool-conv-static.at - testing partial linking of libtool objects 
(convenience, static)
+# Written by Marc Alff
+
+AT_SETUP([Reloc libtool convenience static])
+AT_KEYWORDS([libtool])
+LDFLAGS=""
+
+## Design notes
+## ============
+#
+# This test requires :
+# - "enable static libraries"
+
+AT_CHECK(
+   [($LIBTOOL --features | grep "enable static libraries" ) || exit 77],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_DATA(a.c,
+[[
+extern void foo_a() {}
+extern const char* str_a ;
+const char* str_a = "The content of a.c is in here.\n" ;
+extern const char* pic_a ;
+const char* pic_a = "A: "
+#ifdef PIC
+   "PIC defined"
+#else
+   "PIC not defined"
+#endif
+   ;
+]])
+
+AT_DATA(b.c,
+[[
+extern void foo_b() {}
+extern const char* str_b ;
+const char* str_b = "The content of b.c is in here.\n" ;
+]])
+
+AT_DATA(c.c,
+[[
+extern void foo_c() {}
+extern const char* str_c ;
+const char* str_c = "The content of c.c is in here.\n" ;
+extern const char* pic_c ;
+const char* pic_c = "C: "
+#ifdef PIC
+   "PIC defined"
+#else
+   "PIC not defined"
+#endif
+   ;
+]])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -static -c a.c -o a.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -static -c b.c -o b.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -static -c c.c -o c.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $LDFLAGS -static -o libconv.la c.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+# Linking *.lo objects, with -static, with a convenience library
+# libconv.la should be added in the result.
+# expecting a *.lo to be created, with a non-PIC only.
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -static -o all.lo a.lo b.lo 
libconv.la],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify all.$OBJEXT
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "The content of a\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "The content of b\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "The content of c\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all.$OBJEXT | grep "foo_a"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all.$OBJEXT | grep "foo_b"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all.$OBJEXT | grep "foo_c"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "A: PIC not defined"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "C: PIC not defined"],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify .libs/all.o is not created
+
+AT_CHECK(
+   [! test -f .libs/all.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify all.lo
+
+AT_CHECK(
+   [cat all.lo | grep "^non_pic_object='all.$OBJEXT'"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [cat all.lo | grep "^pic_object=none"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CLEANUP
+
diff -Naur libtool/tests/reloc-libtool-conv.at 
libtool-reloc/tests/reloc-libtool-conv.at
--- libtool/tests/reloc-libtool-conv.at 1970-01-01 00:00:00.000000000 +0000
+++ libtool-reloc/tests/reloc-libtool-conv.at   2006-04-09 15:57:40.000000000 
+0000
@@ -0,0 +1,236 @@
+# Hand crafted tests for GNU Libtool.                         -*- Autotest -*-
+# Copyright 2006 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.
+
+# reloc-libtool-conv.at - testing partial linking of libtool objects 
(convenience)
+# Written by Marc Alff
+
+AT_SETUP([Reloc libtool convenience])
+AT_KEYWORDS([libtool])
+LDFLAGS=""
+
+## Design notes
+##
+## This test requires both:
+## - "enable shared libraries"
+## - "enable static libraries"
+##
+## See the following tests :
+## - reloc-libtool-conv-static.at
+## - reloc-libtool-conv-shared.at
+## which tests only the static/shared behavior.
+
+AT_CHECK(
+   [($LIBTOOL --features | grep "enable shared libraries" ) || exit 77],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [($LIBTOOL --features | grep "enable static libraries" ) || exit 77],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_DATA(a.c,
+[[
+extern void foo_a() {}
+extern const char* str_a ;
+const char* str_a = "The content of a.c is in here.\n" ;
+extern const char* pic_a ;
+const char* pic_a = "A: "
+#ifdef PIC
+   "PIC defined"
+#else
+   "PIC not defined"
+#endif
+   ;
+]])
+
+AT_DATA(b.c,
+[[
+extern void foo_b() {}
+extern const char* str_b ;
+const char* str_b = "The content of b.c is in here.\n" ;
+]])
+
+AT_DATA(c.c,
+[[
+extern void foo_c() {}
+extern const char* str_c ;
+const char* str_c = "The content of c.c is in here.\n" ;
+extern const char* pic_c ;
+const char* pic_c = "C: "
+#ifdef PIC
+   "PIC defined"
+#else
+   "PIC not defined"
+#endif
+   ;
+]])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -c a.c -o a.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -c b.c -o b.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -c c.c -o c.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $LDFLAGS -o libconv.la c.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+# Linking *.lo objects, with a convenience library
+# libconv.la should be added in the result.
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o all.lo a.lo b.lo libconv.la],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify all.$OBJEXT
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "The content of a\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "The content of b\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "The content of c\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all.$OBJEXT | grep "foo_a"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all.$OBJEXT | grep "foo_b"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all.$OBJEXT | grep "foo_c"],
+   [0],
+   [ignore],
+   [ignore])
+
+## REVIEW-ME : confirm it's the expected result.
+AT_CHECK(
+   [strings all.$OBJEXT | grep "A: PIC not defined"],
+   [0],
+   [ignore],
+   [ignore])
+
+## REVIEW-ME : the pic code is used instead, why ?
+## AT_CHECK(
+##    [strings all.$OBJEXT | grep "C: PIC not defined"],
+##    [0],
+##    [ignore],
+##    [ignore])
+
+# Verify .libs/all.o
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "The content of a\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "The content of b\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "The content of c\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM .libs/all.$OBJEXT | grep "foo_a"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM .libs/all.$OBJEXT | grep "foo_b"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM .libs/all.$OBJEXT | grep "foo_c"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "A: PIC defined"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "C: PIC defined"],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify all.lo
+
+AT_CHECK(
+   [cat all.lo | grep "^non_pic_object='all.$OBJEXT'"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [cat all.lo | grep "^pic_object='\.libs/all.$OBJEXT'"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CLEANUP
+
diff -Naur libtool/tests/reloc-libtool-shared.at 
libtool-reloc/tests/reloc-libtool-shared.at
--- libtool/tests/reloc-libtool-shared.at       1970-01-01 00:00:00.000000000 
+0000
+++ libtool-reloc/tests/reloc-libtool-shared.at 2006-04-09 15:57:40.000000000 
+0000
@@ -0,0 +1,136 @@
+# Hand crafted tests for GNU Libtool.                         -*- Autotest -*-
+# Copyright 2006 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.
+
+# reloc-libtool-shared.at - testing partial linking of libtool objects 
(-shared)
+# Written by Marc Alff
+
+AT_SETUP([Reloc libtool shared])
+AT_KEYWORDS([libtool])
+LDFLAGS=""
+
+## Design notes
+## ============
+#
+# This test requires :
+# - "enable shared libraries"
+
+AT_CHECK(
+   [($LIBTOOL --features | grep "enable shared libraries" ) || exit 77],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_DATA(a.c,
+[[
+extern void foo_a() {}
+extern const char* str_a ;
+const char* str_a = "The content of a.c is in here.\n" ;
+extern const char* pic_a ;
+const char* pic_a = "A: "
+#ifdef PIC
+   "PIC defined"
+#else
+   "PIC non defined"
+#endif
+   ;
+]])
+
+AT_DATA(b.c,
+[[
+extern void foo_b() {}
+extern const char* str_b ;
+const char* str_b = "The content of b.c is in here.\n" ;
+]])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -shared -c a.c -o a.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -shared -c b.c -o b.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+# Linking *.lo with -shared :
+# expecting a *.lo to be created, with PIC only
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -shared -o all.lo a.lo b.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify all.$OBJEXT is not created
+
+AT_CHECK(
+   [! test -f all.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify .libs/all.o
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "The content of a\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "The content of b\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM .libs/all.$OBJEXT | grep "foo_a"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM .libs/all.$OBJEXT | grep "foo_b"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "PIC defined"],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify all.lo
+
+AT_CHECK(
+   [cat all.lo | grep "^non_pic_object=none"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [cat all.lo | grep "^pic_object='\.libs/all.$OBJEXT'"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CLEANUP
+
diff -Naur libtool/tests/reloc-libtool-static.at 
libtool-reloc/tests/reloc-libtool-static.at
--- libtool/tests/reloc-libtool-static.at       1970-01-01 00:00:00.000000000 
+0000
+++ libtool-reloc/tests/reloc-libtool-static.at 2006-04-09 15:57:40.000000000 
+0000
@@ -0,0 +1,136 @@
+# Hand crafted tests for GNU Libtool.                         -*- Autotest -*-
+# Copyright 2006 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.
+
+# reloc-libtool-static.at - testing partial linking of libtool objects 
(-static)
+# Written by Marc Alff
+
+AT_SETUP([Reloc libtool static])
+AT_KEYWORDS([libtool])
+LDFLAGS=""
+
+## Design notes
+## ============
+#
+# This test requires :
+# - "enable static libraries"
+
+AT_CHECK(
+   [($LIBTOOL --features | grep "enable static libraries" ) || exit 77],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_DATA(a.c,
+[[
+extern void foo_a() {}
+extern const char* str_a ;
+const char* str_a = "The content of a.c is in here.\n" ;
+extern const char* pic_a ;
+const char* pic_a = "A: "
+#ifdef PIC
+   "PIC defined"
+#else
+   "PIC not defined"
+#endif
+   ;
+]])
+
+AT_DATA(b.c,
+[[
+extern void foo_b() {}
+extern const char* str_b ;
+const char* str_b = "The content of b.c is in here.\n" ;
+]])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -static -c a.c -o a.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -static -c b.c -o b.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+# Linking *.lo with -static :
+# expecting a *.lo to be created, with a non-PIC only.
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -static -o all.lo a.lo b.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify all.$OBJEXT
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "The content of a\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "The content of b\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all.$OBJEXT | grep "foo_a"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all.$OBJEXT | grep "foo_b"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "PIC not defined"],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify .libs/all.o is not created
+
+AT_CHECK(
+   [! test -f .libs/all.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify all.lo
+
+AT_CHECK(
+   [cat all.lo | grep "^non_pic_object='all.$OBJEXT'"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [cat all.lo | grep "^pic_object=none"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CLEANUP
+
diff -Naur libtool/tests/reloc-libtool.at libtool-reloc/tests/reloc-libtool.at
--- libtool/tests/reloc-libtool.at      1970-01-01 00:00:00.000000000 +0000
+++ libtool-reloc/tests/reloc-libtool.at        2006-04-09 15:57:40.000000000 
+0000
@@ -0,0 +1,168 @@
+# Hand crafted tests for GNU Libtool.                         -*- Autotest -*-
+# Copyright 2006 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.
+
+# reloc-libtool.at - testing partial linking of libtool objects
+# Written by Marc Alff
+
+AT_SETUP([Reloc libtool])
+AT_KEYWORDS([libtool])
+LDFLAGS=""
+
+## Design notes
+##
+## This test requires both:
+## - "enable shared libraries"
+## - "enable static libraries"
+##
+## See the following tests :
+## - reloc-libtool-static.at
+## - reloc-libtool-shared.at
+## which tests only the static/shared behavior.
+
+AT_CHECK(
+   [($LIBTOOL --features | grep "enable shared libraries" ) || exit 77],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [($LIBTOOL --features | grep "enable static libraries" ) || exit 77],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_DATA(a.c,
+[[
+extern void foo_a() {}
+extern const char* str_a ;
+const char* str_a = "The content of a.c is in here.\n" ;
+extern const char* pic_a ;
+const char* pic_a = "A: "
+#ifdef PIC
+   "PIC defined"
+#else
+   "PIC not defined"
+#endif
+   ;
+]])
+
+AT_DATA(b.c,
+[[
+extern void foo_b() {}
+extern const char* str_b ;
+const char* str_b = "The content of b.c is in here.\n" ;
+]])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -c a.c -o a.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -c b.c -o b.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o all.lo a.lo b.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify all.$OBJEXT
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "The content of a\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "The content of b\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all.$OBJEXT | grep "foo_a"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all.$OBJEXT | grep "foo_b"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "A: PIC not defined"],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify .libs/all.o
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "The content of a\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "The content of b\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM .libs/all.$OBJEXT | grep "foo_a"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM .libs/all.$OBJEXT | grep "foo_b"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings .libs/all.$OBJEXT | grep "A: PIC defined"],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify all.lo
+
+AT_CHECK(
+   [cat all.lo | grep "^non_pic_object='all.$OBJEXT'"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [cat all.lo | grep "^pic_object='\.libs/all.$OBJEXT'"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CLEANUP
+
diff -Naur libtool/tests/reloc-objext-conv.at 
libtool-reloc/tests/reloc-objext-conv.at
--- libtool/tests/reloc-objext-conv.at  1970-01-01 00:00:00.000000000 +0000
+++ libtool-reloc/tests/reloc-objext-conv.at    2006-04-09 15:57:40.000000000 
+0000
@@ -0,0 +1,145 @@
+# Hand crafted tests for GNU Libtool.                         -*- Autotest -*-
+# Copyright 2006 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.
+
+# reloc-objext-conv.at - testing partial linking of non libtool objects 
(convenience)
+# Written by Marc Alff
+
+AT_SETUP([Reloc objext convenience])
+AT_KEYWORDS([libtool])
+LDFLAGS=""
+
+## Design notes
+## ============
+#
+# This test (using objext) requires :
+# - "enable static libraries"
+
+AT_CHECK(
+   [($LIBTOOL --features | grep "enable static libraries" ) || exit 77],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_DATA(a.c,
+[[
+extern void foo_a() {}
+extern const char* str_a ;
+const char* str_a = "The content of a.c is in here.\n" ;
+]])
+
+AT_DATA(b.c,
+[[
+extern void foo_b() {}
+extern const char* str_b ;
+const char* str_b = "The content of b.c is in here.\n" ;
+]])
+
+AT_DATA(c.c,
+[[
+extern void foo_c() {}
+extern const char* str_c ;
+const char* str_c = "The content of c.c is in here.\n" ;
+]])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -c a.c -o a.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -c b.c -o b.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -c c.c -o c.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $LDFLAGS -o libconv.la c.lo],
+   [0],
+   [ignore],
+   [ignore])
+
+# Linking *.OBJEXT objects
+# The convenience library libconv.la should be added too.
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $LDFLAGS -o all.$OBJEXT a.$OBJEXT b.$OBJEXT 
libconv.la],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "The content of a\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "The content of b\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "The content of c\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all.$OBJEXT | grep "foo_a"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all.$OBJEXT | grep "foo_b"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all.$OBJEXT | grep "foo_c"],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify .libs/all.o is not created
+
+AT_CHECK(
+   [! test -f .libs/all.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify all.lo is not created
+
+AT_CHECK(
+   [! test -f .libs/all.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CLEANUP
+
diff -Naur libtool/tests/reloc-objext-lib.at 
libtool-reloc/tests/reloc-objext-lib.at
--- libtool/tests/reloc-objext-lib.at   1970-01-01 00:00:00.000000000 +0000
+++ libtool-reloc/tests/reloc-objext-lib.at     2006-04-09 15:57:40.000000000 
+0000
@@ -0,0 +1,193 @@
+# Hand crafted tests for GNU Libtool.                         -*- Autotest -*-
+# Copyright 2006 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.
+
+# reloc-objext-lib.at - testing partial linking of non libtool objects (lib)
+# Written by Marc Alff
+
+AT_SETUP([Reloc objext oldlib])
+AT_KEYWORDS([libtool])
+LDFLAGS=""
+
+## Design notes
+## ============
+#
+# This test (using objext) requires :
+# - "enable static libraries"
+
+## REVIEW-ME FIXME : this script uses *.a. I don't know if $LIBEXT should be 
used
+## to account for *.lib, nor where to get the value from,
+## so this test might fail on windows platforms.
+
+AT_CHECK(
+   [($LIBTOOL --features | grep "enable static libraries" ) || exit 77],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_DATA(a.c,
+[[
+extern void foo_a() {}
+extern const char* str_a ;
+const char* str_a = "The content of a.c is in here.\n" ;
+]])
+
+AT_DATA(b.c,
+[[
+extern void foo_b() {}
+extern const char* str_b ;
+const char* str_b = "The content of b.c is in here.\n" ;
+]])
+
+AT_DATA(c.c,
+[[
+extern void hook_extra() {}
+extern void foo_c() {}
+extern const char* str_c ;
+const char* str_c = "The content of c.c is in here.\n" ;
+]])
+
+AT_DATA(ref.c,
+[[
+extern void hook_extra() ;
+extern void foo_ref() { hook_extra() ; }
+]])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -c a.c -o a.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -c b.c -o b.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -c c.c -o c.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+## REVIEW-ME FIXME : either the syntax is wrong, or something is broken (even 
in 1.5.22),
+## because the ar cru command generated does create an empty libextra.a 
(without c.o)
+## as a result, this test later fails
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $LDFLAGS -o libextra.a c.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -c ref.c -o ref.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+# Test 1) : ref.$OBJEXT is not part of the code.
+# Linking *.OBJEXT objects with libextra.a
+# Nothing from libextra should be included, as no reference leads to it.
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $LDFLAGS -o all1.$OBJEXT a.$OBJEXT b.$OBJEXT 
libextra.a],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all1.$OBJEXT | grep "The content of a\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all1.$OBJEXT | grep "The content of b\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+# rc = 1, it's not there.
+AT_CHECK(
+   [strings all1.$OBJEXT | grep "The content of c\.c is in here\."],
+   [1],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all1.$OBJEXT | grep "foo_a"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all1.$OBJEXT | grep "foo_b"],
+   [0],
+   [ignore],
+   [ignore])
+
+# rc = 1, it's not there.
+AT_CHECK(
+   [$NM all1.$OBJEXT | grep "foo_c"],
+   [1],
+   [ignore],
+   [ignore])
+
+# Verify .libs/all.o is not created
+
+AT_CHECK(
+   [! test -f .libs/all1.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify all.lo is not created
+
+AT_CHECK(
+   [! test -f .libs/all1.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+ 
+# Test 2) : ref.$OBJEXT is part of the code.
+# Linking *.OBJEXT objects with libextra.$LIBEXT
+# Nothing from libextra should be included, as no reference leads to it.
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $LDFLAGS -o all2.$OBJEXT a.$OBJEXT ref.$OBJEXT 
libextra.a],
+   [0],
+   [ignore],
+   [ignore])
+
+## REVIEW-ME : on hold since libextra.a can not be built, see above
+## AT_CHECK(
+##    [strings all2.$OBJEXT | grep "The content of c\.c is in here\."],
+##    [0],
+##    [ignore],
+##    [ignore])
+
+## REVIEW-ME : on hold since libextra.a can not be built, see above
+## AT_CHECK(
+##    [$NM all2.$OBJEXT | grep "foo_c"],
+##    [0],
+##    [ignore],
+##    [ignore])
+
+AT_CLEANUP
+
diff -Naur libtool/tests/reloc-objext.at libtool-reloc/tests/reloc-objext.at
--- libtool/tests/reloc-objext.at       1970-01-01 00:00:00.000000000 +0000
+++ libtool-reloc/tests/reloc-objext.at 2006-04-09 15:57:40.000000000 +0000
@@ -0,0 +1,147 @@
+# Hand crafted tests for GNU Libtool.                         -*- Autotest -*-
+# Copyright 2006 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.
+
+# reloc-objext.at - testing partial linking of non libtool objects
+# Written by Marc Alff
+
+AT_BANNER([Partial linking.])
+
+## Test suite design notes
+## =======================
+#
+# Naming conventions for the test suite :
+# reloc {-objext|-libtool} {{}|-conv|-lib} ({}|-static|-shared} .at
+# reloc {-errors} .at
+#
+# reloc : this is a test producting a relocatable
+# -objext : the output is a file *.OBJEXT (so *.o or *.obj), which is an 'old' 
object
+# -libtool : the output is a file *.lo, which is a 'libtool' object
+# -conv : a convinience library (*.la) is added to the inputs
+# -lib : a static library *.$libext (so *.a or *.lib) is added to the inputs
+# -static : the build is done using -static only : no shared objects are built
+# -shared : the build is done using -shared only : no static objects are built
+# -error : collection of illegal combinations
+#
+# The meaningful combinations to tests are :
+# reloc-objext
+# reloc-objext-conv
+# reloc-objext-lib
+# reloc-libtool
+# reloc-libtool-static
+# reloc-libtool-shared
+# reloc-libtool-conv
+# reloc-libtool-conv-static
+# reloc-libtool-conv-shared
+# reloc-error
+#
+# the *-static tests are only available on platforms with "enable static 
libraries"
+# the *-shared tests are only available on platforms with "enable shared 
libraries"
+
+AT_SETUP([Reloc objext])
+AT_KEYWORDS([libtool])
+LDFLAGS=""
+
+## Design notes
+## ============
+#
+# This test (using objext) requires :
+# - "enable static libraries"
+
+AT_CHECK(
+   [($LIBTOOL --features | grep "enable static libraries" ) || exit 77],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_DATA(a.c,
+[[
+extern void foo_a() {}
+extern const char* str_a ;
+const char* str_a = "The content of a.c is in here.\n" ;
+]])
+
+AT_DATA(b.c,
+[[
+extern void foo_b() {}
+extern const char* str_b ;
+const char* str_b = "The content of b.c is in here.\n" ;
+]])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -c a.c -o a.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$LIBTOOL --mode=compile $CC $CFLAGS -c b.c -o b.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+# Linking *.OBJEXT objects.
+# The expected result is a plain old object.
+
+AT_CHECK(
+   [$LIBTOOL --mode=link $CC $LDFLAGS -o all.$OBJEXT a.$OBJEXT b.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "The content of a\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [strings all.$OBJEXT | grep "The content of b\.c is in here\."],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all.$OBJEXT | grep "foo_a"],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CHECK(
+   [$NM all.$OBJEXT | grep "foo_b"],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify .libs/all.o is not created
+
+AT_CHECK(
+   [! test -f .libs/all.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+# Verify all.lo is not created
+
+AT_CHECK(
+   [! test -f .libs/all.$OBJEXT],
+   [0],
+   [ignore],
+   [ignore])
+
+AT_CLEANUP
+

reply via email to

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