]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
On Windows, find potential libs regardless of file name case.
authorPeter Rosin <peda@lysator.liu.se>
Sat, 2 Aug 2008 12:54:10 +0000 (14:54 +0200)
committerPeter Rosin <peda@lysator.liu.se>
Tue, 13 Jan 2009 09:03:06 +0000 (10:03 +0100)
* 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.

ChangeLog
Makefile.am
libltdl/config/ltmain.m4sh
libltdl/m4/libtool.m4
tests/nocase.at [new file with mode: 0644]

index 9fb8df597cc2bcb8a2ea65d15712005aa3e52a75..935f7c194554b03c3f2f129eb3f5b553f5469b28 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-08-02  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.
+
 2008-08-02  Peter Rosin  <peda@lysator.liu.se>
 
        Allow Microsoft lib to be used as the archiver.
index 089a482603135481982442de3d7638d28b77b23e..60619a9350446195ff3ca3524db048fe0d4d27ee 100644 (file)
@@ -468,6 +468,7 @@ TESTSUITE_AT        = tests/testsuite.at \
                  tests/execute-mode.at \
                  tests/infer-tag.at \
                  tests/localization.at \
+                 tests/nocase.at \
                  tests/install.at \
                  tests/destdir.at \
                  tests/old-m4-iface.at \
index 432c8e57b3395651be8710d0d8df5743ebb2a327..0ab6537a61266286eac6b36b9b6c7e05059448b7 100644 (file)
@@ -6389,8 +6389,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 fb7f3e22b0c4a68c4ee7a5d24d35517f74d8983b..ca032ed10df7d5333947de42e9bbd52757ea86d1 100644 (file)
@@ -3140,6 +3140,23 @@ tpf*)
   ;;
 esac
 ])
+
+case $host_os in
+cygwin* | mingw* | pw32*)
+  if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+    file_magic_glob=
+    want_nocaseglob=yes
+  else
+    file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+    want_nocaseglob=no
+  fi
+  ;;
+*)
+  file_magic_glob=
+  want_nocaseglob=no
+  ;;
+esac
+
 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
@@ -3148,6 +3165,10 @@ _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"])
+_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..3627a8f
--- /dev/null
@@ -0,0 +1,82 @@
+# nocase.at --  test for nocase lib search  -*- Autotest -*-
+#
+#   Copyright (C) 2007 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])
+
+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])
+
+eval `$EGREP '^(old_library)=' < $libdir/libbar.la`
+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 main.$OBJEXT -L$libdir -lbar],
+        [], [ignore], [ignore])
+
+AT_CLEANUP