From: Alexandre Oliva Date: Mon, 25 Jan 1999 10:01:23 +0000 (+0000) Subject: * ltmain.in (file_magic): use egrep instead of expr to support X-Git-Tag: release-1-2f~180 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01d7b2340e0234ebb2a423fd6e2e716bb0832abb;p=thirdparty%2Flibtool.git * ltmain.in (file_magic): use egrep instead of expr to support more general regular expressions (file_regex): remove it; the name is misleading, it's not used * ltconfig.in, doc/libtool.texi: ditto * ltconfig.in (linux-gnu*, deplibs_check_method): extend regex to support `LSB dynamic lib' in the output of `file' Reported by Scott D. Heavner --- diff --git a/ChangeLog b/ChangeLog index 2cf8c18d6..1b9bfa74b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 1999-01-25 Alexandre Oliva + * ltmain.in (file_magic): use egrep instead of expr to support + more general regular expressions + (file_regex): remove it; the name is misleading, it's not used + anywhere, and probably will never be + * ltconfig.in, doc/libtool.texi: ditto + * ltconfig.in (linux-gnu*, deplibs_check_method): extend regex to + support `LSB dynamic lib' in the output of `file' + Reported by Scott D. Heavner + * ltmain.in (dependency_libs, xrpath): add -R switches to dependency_libs only just before creating the .la file; they should not be passed to the C compiler or linker at diff --git a/doc/libtool.texi b/doc/libtool.texi index 10b9c21ad..70daa9c6b 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -3141,31 +3141,21 @@ are included in @samp{$archive_cmds} somewhere and also sets the @vindex file_magic @vindex file_magic_command looks in the library link path for libraries that have the right -libname. Then it runs @samp{$file_magic_command} on the library and checks -for a match against [regex] using expr. I currently have linux-elf looking -for the string: "ELF [0-9][0-9]*-bit [LM]SB shared object" on the output of -@samp{file}. This is option that works best I think. - -@item file_regex -@vindex file_regex -will look for a filename in the link path. It doesn't take an argument -because I use the @samp{libname_spec} and @samp{library_names_spec} -variables to create the string to look for. I don't like it because -symlinks and random files can make it give false positives. +libname. Then it runs @samp{$file_magic_command} on the library and +checks for a match against @samp{regex} using @code{egrep}. @item test_compile @vindex test_compile -handles @samp{-L} correctly, I hope. It also takes the names of it's -libraries from libname_spec instead of a hardcoded lib`expr $a_deplib : -'-l/(.*/)'`.so line. +handles @samp{-L} correctly, I hope. It also takes the names of its +libraries from @samp{libname_spec} instead of a hardcoded @code{lib`expr +$a_deplib : '-l/(.*/)'`.so} line. @item pass_all @vindex pass_all -will pass everything without any checking. I put it in because osf3&4 -appear to be treated that way right now... It might be wise to perform -checks here to see if the libraries exist on the system, but I don't -know how osf3&4 handle that, so I thought it would be better just to do -it the way the current code does. +will pass everything without any checking. This may work on platforms +in which code is position-independent by default and inter-library +dependencies are properly supported by the dynamic linker, for example, +on DEC OSF/1 3 and 4. @item none @vindex none diff --git a/ltconfig.in b/ltconfig.in index b46177c16..4d00f4981 100755 --- a/ltconfig.in +++ b/ltconfig.in @@ -1599,16 +1599,13 @@ deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't known. +# `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. -# 'file_regex' -- check by looking for filenames that look like the shared -# library in the library path. -# 'file_magic [regex]' -- check by looking for files in library path which -# responds to the $file_magic_command with a given regex. This is actually a -# superset of the file_regex command. If you have `file' or equivalent on -# your system, you'll want to use this instead. -# Notes: regexs are run through expr. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_command with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 case "$host_os" in aix3*) @@ -1737,7 +1734,7 @@ linux-gnu*) soname_spec='${libname}${release}.so$major' finish_cmds='PATH="$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH - deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' file_magic_command=file if test -f /lib/ld.so.1; then diff --git a/ltmain.in b/ltmain.in index 41e44f30e..87115e71d 100644 --- a/ltmain.in +++ b/ltmain.in @@ -1589,10 +1589,6 @@ compiler." if test "$build_libtool_libs" = yes; then # Transform deplibs into only deplibs that can be linked in shared. - ## Gordon: Do you check for the existence of the libraries in deplibs - ## on the system? That should maybe be merged in here someplace.... - ## Actually: I think test_compile and file_magic do this... file_regex - ## sorta does this. Only pass_all needs to be changed. -Toshio name_save=$name libname_save=$libname release_save=$release @@ -1690,7 +1686,7 @@ EOF fi deplibs=$newdeplibs ;; - file_magic* | file_regex) + file_magic*) set dummy $deplibs_check_method file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`" for a_deplib in $deplibs; do @@ -1698,15 +1694,7 @@ EOF # If $name is empty we are operating on a -L argument. if test "$name" != "" ; then libname=`eval \\$echo \"$libname_spec\"` - case "$deplibs_check_method" in - file_magic*) - for i in $lib_search_path; do - # This needs to be more general than file_regex in order to - # catch things like glibc on linux. Maybe file_regex - # should be more general as well, but maybe not. Since - # library names are supposed to conform to - # library_name_spec, I think file_regex should remain - # strict. What do you think Gordon? + for i in $lib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do # Follow soft links. @@ -1728,30 +1716,15 @@ EOF | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done - file_output=`eval $file_magic_command \"\$potlib\" \ - | sed '11,$d'` - if test `expr "X$file_output" : "X.*$file_magic_regex"` -ne 0 ; then + if eval $file_magic_command \"\$potlib\" \ + | sed '11,$d' \ + | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done - done - ;; - file_regex) - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - for i in $lib_search_path; do - potential_libs=`ls $i/$deplib_match* 2>/dev/null` - if test "$potential_libs" != "" ; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break - fi - done - ;; - esac + done if test -n "$a_deplib" ; then droppeddeps=yes echo