]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
On Windows, find potential libs regardless of file name case.
authorPeter Rosin <peda@lysator.liu.se>
Tue, 15 Jun 2010 20:52:33 +0000 (22:52 +0200)
committerPeter Rosin <peda@lysator.liu.se>
Tue, 15 Jun 2010 20:52:33 +0000 (22:52 +0200)
* libltdl/m4/libtool.m4 (_LT_CHECK_MAGIC_METHOD),
libltdl/config/ltmain.m4sh (func_mode_link): On Windows,
find potential libs regardless of file name case.
* tests/nocase.at: New test, to check for regressions
of the above.
* Makefile.am: Add above new test.
* doc/libtool.texi (libtool script contents): Document
new variables.
* NEWS: Updated.

Signed-off-by: Peter Rosin <peda@lysator.liu.se>
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
Makefile.am
NEWS
doc/libtool.texi
libltdl/config/ltmain.m4sh
libltdl/m4/libtool.m4
tests/nocase.at [new file with mode: 0644]

index bfa340c39405c94634fc219bb6ca88f04e7e7856..958cca9e6cc487794cdf5cca4e0c6db84fe0d628 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2010-06-15  Peter Rosin  <peda@lysator.liu.se>
+
+       On Windows, find potential libs regardless of file name case.
+       * libltdl/m4/libtool.m4 (_LT_CHECK_MAGIC_METHOD),
+       libltdl/config/ltmain.m4sh (func_mode_link): On Windows,
+       find potential libs regardless of file name case.
+       * tests/nocase.at: New test, to check for regressions
+       of the above.
+       * Makefile.am: Add above new test.
+       * doc/libtool.texi (libtool script contents): Document
+       new variables.
+       * NEWS: Updated.
+
 2010-06-15  Philip Allison  <philip.allison@smoothwall.net>  (tiny change)
 
        Avoid GCC -Wall compiler warning in dlopen self test.
index 8e00b3eb41ab66c5903e655e5165d4a8d54d4d72..1114e6773125aa58e19e865d86259f718cb707c2 100644 (file)
@@ -477,6 +477,7 @@ TESTSUITE_AT        = tests/testsuite.at \
                  tests/deplib-in-subdir.at \
                  tests/infer-tag.at \
                  tests/localization.at \
+                 tests/nocase.at \
                  tests/install.at \
                  tests/versioning.at \
                  tests/destdir.at \
diff --git a/NEWS b/NEWS
index 7e65da6d70c17d012c6a97181556c004306f5075..33531dc1ec07f4589e4342a22991690d6f1d016a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,8 @@ New in 2.2.12 2010-08-??: git version 2.2.11a, Libtool team:
 
 * New features:
 
-  - None!
+  - On non-cygwin Windows systems, we now lookup potential library
+    file names without regard to file name case.
 
 New in 2.2.10 2010-06-10: git version 2.2.9a, Libtool team:
 
index 051aec3432e9287f626ae3cf5e65299dc9c7cc74..bf8534ac8d12de7205285b97f4e65edd00df2b04 100644 (file)
@@ -5981,6 +5981,16 @@ and relinking at install time is triggered.  This also means that @var{DESTDIR}
 installation does not work as expected.
 @end defvar
 
+@defvar file_magic_glob
+How to find potential files when @code{deplibs_check_method} is
+@samp{file_magic}. @code{file_magic_glob} is a @code{sed} expression,
+and the @code{sed} instance is fed potential file names that are
+transformed by the @code{file_magic_glob} expression. Useful when the
+shell does not support the shell option @code{nocaseglob}, making
+@code{want_nocaseglob} inappropriate. Normally disabled (i.e.
+@code{file_magic_glob} is empty).
+@end defvar
+
 @defvar finish_cmds
 Commands to tell the dynamic linker how to find shared libraries in a
 specific directory.
@@ -6252,6 +6262,14 @@ The library version numbering type.  One of @samp{libtool},
 @samp{osf}, @samp{sunos}, @samp{windows}, or @samp{none}.
 @end defvar
 
+@defvar want_nocaseglob
+Find potential files using the shell option @code{nocaseglob}, when
+@code{deplibs_check_method} is @samp{file_magic}. Normally set to
+@samp{no}. Set to @samp{yes} to enable the @code{nocaseglob} shell
+option when looking for potential file names in a case-insensitive
+manner.
+@end defvar
+
 @defvar whole_archive_flag_spec
 Compiler flag to generate shared objects from convenience archives.
 @end defvar
index 74c711421dda3b8878df08603d0b34d159e35d6d..99784b416fd8e8f394995b2c07c64b05fd3464fc 100644 (file)
@@ -6381,8 +6381,20 @@ EOF
              fi
              if test -n "$a_deplib" ; then
                libname=`eval "\\$ECHO \"$libname_spec\""`
+               if test -n "$file_magic_glob"; then
+                 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
+               else
+                 libnameglob=$libname
+               fi
+               test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+                 if test "$want_nocaseglob" = yes; then
+                   shopt -s nocaseglob
+                   potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+                   $nocaseglob
+                 else
+                   potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+                 fi
                  for potent_lib in $potential_libs; do
                      # Follow soft links.
                      if ls -lLd "$potent_lib" 2>/dev/null |
index d35aab0d14dd206a22917ac120c3313ef9a27f03..a91bd615794a9d33296bafbdf59360e16ff2857a 100644 (file)
@@ -3163,6 +3163,21 @@ tpf*)
   ;;
 esac
 ])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -3170,7 +3185,11 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
 _LT_DECL([], [deplibs_check_method], [1],
     [Method to check whether dependent libraries are shared objects])
 _LT_DECL([], [file_magic_cmd], [1],
-    [Command to use when deplibs_check_method == "file_magic"])
+    [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+    [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
 ])# _LT_CHECK_MAGIC_METHOD
 
 
diff --git a/tests/nocase.at b/tests/nocase.at
new file mode 100644 (file)
index 0000000..faacc0d
--- /dev/null
@@ -0,0 +1,85 @@
+# nocase.at --  test for nocase lib search  -*- Autotest -*-
+#
+#   Copyright (C) 2010 Free Software Foundation, Inc.
+#   Written by Peter Rosin, 2007
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool 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.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+####
+
+
+AT_SETUP([nocase library search])
+AT_KEYWORDS([libtool])
+
+eval `$LIBTOOL --config | $EGREP '^(want_nocaseglob|file_magic_glob)='`
+
+AT_CHECK([test "$want_nocaseglob" != yes && ]dnl
+         [test -z "$file_magic_glob" && exit 77],
+         [1], [ignore], [ignore])
+
+mkdir foo
+AT_DATA([foo/Foo.c],
+[
+int Foo (void) { return 1; }
+])
+
+mkdir bar
+AT_DATA([bar/bar.c],
+[
+extern int Foo (void);
+int bar (void) { return Foo (); }
+])
+
+AT_DATA([main.c],
+[
+extern int bar (void);
+int main (void) { return bar (); }
+])
+
+libdir=`pwd`/inst/lib
+mkdir inst inst/bin inst/lib
+
+$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o foo/Foo.lo foo/Foo.c
+AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o foo/libFoo.la foo/Foo.lo ]dnl
+        [-no-undefined -version-info 1:0:0 -rpath $libdir],
+        [], [ignore], [ignore])
+AT_CHECK([$LIBTOOL --mode=install cp foo/libFoo.la $libdir],
+        [], [ignore], [ignore])
+AT_CHECK([$LIBTOOL --mode=clean rm -f foo/libFoo.la],
+        [], [ignore], [ignore])
+
+rm -f $libdir/libFoo.la
+
+$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o bar/bar.lo bar/bar.c
+AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o bar/libbar.la bar/bar.lo ]dnl
+        [-L$libdir -lfoo -no-undefined -version-info 1:0:0 -rpath $libdir],
+        [], [ignore], [ignore])
+AT_CHECK([$LIBTOOL --mode=install cp bar/libbar.la $libdir],
+        [], [ignore], [ignore])
+
+str=`$EGREP '^(old_library)=' < $libdir/libbar.la`
+eval "$str"
+libbar=$old_library
+rm -f $libdir/$libbar
+
+$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c -o main.$OBJEXT main.c
+
+AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT -L$libdir -lbar],
+        [], [ignore], [ignore])
+
+AT_CLEANUP