]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libtool.m4 (AC_PATH_FILE): new macro replaces
authorGary V. Vaughan <gary@gnu.org>
Sun, 10 Oct 1999 00:47:55 +0000 (00:47 +0000)
committerGary V. Vaughan <gary@gnu.org>
Sun, 10 Oct 1999 00:47:55 +0000 (00:47 +0000)
AC_PATH_TOOL_GREP_OUTPUT.
(AC_PATH_TOOL_PREFIX): new macro replaces
AC_PATH_PROG_GREP_OUTPUT.
(AC_LD_RELOAD_FLAG):  migrated from ltconfig.in.
(AC_DEPLIBS_CHECK_METHOD): ditto.
* ltconfig.in (reload_flag): moved to libtool.m4.
(deplbs_check_method): ditto.

ChangeLog
libtool.m4
ltconfig.in

index cbe3eb6f77ab9e9bae4c2c65c48201d4ff0f1bc8..4fed60c7d99027c4f25c12bb46b9c99b61bf8e78 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+1999-10-10  Gary V. Vaughan  <gary@oranda.demon.co.uk>
+
+       * libtool.m4 (AC_PATH_FILE): new macro replaces
+       AC_PATH_TOOL_GREP_OUTPUT.
+       (AC_PATH_TOOL_PREFIX): new macro replaces
+       AC_PATH_PROG_GREP_OUTPUT.
+       (AC_LD_RELOAD_FLAG):  migrated from ltconfig.in.
+       (AC_DEPLIBS_CHECK_METHOD): ditto.
+       * ltconfig.in (reload_flag): moved to libtool.m4.
+       (deplbs_check_method): ditto.
+
 1999-10-07  Gary V. Vaughan  <gary@oranda.demon.co.uk>
 
        * libtool.m4 (AC_PATH_PROG_VERSION_GREP): removed in favour of the 
index 31338be1d094ca0779ad508f9ba72a45893ce759..3e002db8f92ba9b8ce7a4a7035901fae4b7e467e 100644 (file)
@@ -62,19 +62,26 @@ AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 AC_REQUIRE([AC_PROG_CC])dnl
 with_gcc="$GCC"; AC_SUBST([with_gcc])
 AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
 AC_REQUIRE([AC_PROG_NM])dnl
 AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
 AC_REQUIRE([AC_OBJEXT])dnl
 AC_REQUIRE([AC_EXEEXT])dnl
 dnl
 
+# Only perform the check for file, if the check method requires it
+case "$deplibs_check_method" in
+file_magic*)
+  if test "$file_magic_cmd" == '$FILE'; then
+    AC_PATH_FILE
+  fi
+  ;;
+esac
+
 AC_CHECK_TOOL(RANLIB, ranlib, :)
 AC_CHECK_TOOL(STRIP, strip, :)
 
-echo 'This is only a test.' > conftest.txt
-AC_PATH_TOOL_GREP_OUTPUT(FILE, file conftest.txt, text, :, "/usr/bin:$PATH")
-rm -rf conftest*
-
 # Check for any special flags to pass to ltconfig.
 libtool_flags="--cache-file=$cache_file"
 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
@@ -270,43 +277,62 @@ AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
 AC_ENABLE_FAST_INSTALL(no)])
 
 
-# AC_PATH_PROG_GREP_OUTPUT - look for a particular expression in the output
-#                             generated by $PROG
-dnl  AC_PATH_PROG_GREP_OUTPUT(VARIABLE, PROG-TO-CHECK-FOR, GREP-EXPRESSION[, VALUE-IF-NOT-FOUND[, PATH]])
-AC_DEFUN(AC_PATH_PROG_GREP_OUTPUT,
-[# Extract the first word of "$2", so it can be a program name with args.
-set dummy $2; ac_word=[$]2
-AC_MSG_CHECKING([for $ac_word])
-AC_CACHE_VAL(ac_cv_path_$1,
-[case "[$]$1" in
+# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
+AC_DEFUN(AC_PATH_TOOL_PREFIX,
+[AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_FILE,
+[case "$FILE" in
   /*)
-  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
+  lt_cv_path_FILE="$FILE" # Let the user override the test with a path.
   ;;
   ?:/*)
-  ac_cv_path_$1="[$]$1" # Let the user override the test with a dos path.
+  ac_cv_path_FILE="$FILE" # Let the user override the test with a dos path.
   ;;
   *)
+  ac_save_file="$FILE"
   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
 dnl $ac_dummy forces splitting on constant user-supplied paths.
 dnl POSIX.2 word splitting is done only on the output of word expansions,
 dnl not every word.  This closes a longstanding sh security hole.
-  ac_dummy="ifelse([$5], , $PATH, [$5])"
+  ac_dummy="ifelse([$2], , $PATH, [$2])"
   for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
-    if eval '$ac_dir/$2' 2>&1 | grep $3 >/dev/null 2>&1; then
-      ac_cv_path_$1="$ac_dir/$ac_word"
+    if test -f $ac_dir/$1; then
+      lt_cv_path_FILE="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+        case "$deplibs_check_method" in
+        "file_magic "*)
+          file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+         FILE="$lt_cv_path_FILE"
+          if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+            egrep "$file_magic_regex" > /dev/null; then
+            :
+          else
+            cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+          fi ;;
+        esac
+      fi
       break
     fi
   done
   IFS="$ac_save_ifs"
-dnl If no 4th arg is given, leave the cache variable unset
-ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
-])dnl
+  FILE="$ac_save_file"
   ;;
-esac])dnl
-$1="$ac_cv_path_$1"
-if test -n "[$]$1"; then
-  AC_MSG_RESULT([$]$1)
+esac])
+FILE="$lt_cv_path_FILE"
+if test -n "$FILE"; then
+  AC_MSG_RESULT($FILE)
 else
   AC_MSG_RESULT(no)
 fi
@@ -314,22 +340,18 @@ AC_SUBST($1)dnl
 ])
 
 
-# AC_PATH_TOOL_GREP_OUTPUT - Try AC_PATH_PROG_GREP_OUTPUT with target 
-#                             prefix when cross-compiling
-dnl AC_PATH_TOOL_GREP_OUTPUT(VARIABLE, PROG-TO-CHECK-FOR, GREP-EXPRESSION[, VALUE-IF-NOT-FOUND [, PATH]])
-AC_DEFUN(AC_PATH_TOOL_GREP_OUTPUT,
+# AC_PATH_FILE - find a file program which can recognise a shared library
+AC_DEFUN(AC_PATH_FILE,
 [AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
-AC_PATH_PROG_GREP_OUTPUT($1, ${ac_tool_prefix}$2, $3, 
-                         ifelse([$4], , [$2], ), $5)
-ifelse([$4], , , [
-  if test -z "$ac_cv_prog_$1"; then
-    if test -n "$ac_tool_prefix"; then
-      AC_PATH_PROG_GREP_OUTPUT($1, $2, $3, $2, $5)
-    else
-      $1="$4"
-    fi
+AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
+if test -z "$lt_cv_path_FILE"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
+  else
+    FILE=:
   fi
-])
+fi
+AC_SUBST(FILE)dnl
 ])
 
 
@@ -423,6 +445,131 @@ with_gnu_ld=$ac_cv_prog_gnu_ld
 AC_SUBST(with_gnu_ld)
 ])
 
+# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN(AC_PROG_LD_RELOAD_FLAG,
+[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
+[lt_cv_ld_reload_flag='-r'])
+reload_flag=$ac_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+AC_SUBST(reload_flag)
+])
+
+# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN(AC_DEPLIBS_CHECK_METHOD,
+[AC_CACHE_CHECK([how to recognise dependant libraries], 
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$FILE'
+lt_cv_file_magic_test_file=
+lt_cv_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 know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [regex]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd 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.
+
+case "$host_os" in
+aix4* | beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+  
+bsdi4*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;  
+
+cygwin* | mingw*)
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='${OBJDUMP} -f'
+  ;;
+
+freebsd*)
+  case "$version_type" in
+  freebsd-elf*)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+  
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+  
+irix5* | irix6*)
+  case "$host_os" in
+  irix5*)
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+    ;;
+  *)
+    case "$LD" in
+    *-32|*"-32 ") libmagic=32-bit;;
+    *-n32|*"-n32 ") libmagic=N32;;
+    *-64|*"-64 ") libmagic=64-bit;;
+    *) libmagic=never-match;;
+    esac
+    # this will be overridden with pass_all, but let us keep it just in case
+    lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
+    ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+  case "$host_cpu" in
+  alpha* | i*86 | sparc* )
+    lt_cv_deplibs_check_method=pass_all ;;
+  *)
+    # glibc up to 2.1.1 does not perform some relocations on ARM
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
+  esac
+  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+  ;;
+
+osf3* | osf4* | osf5*)
+  # this will be overridden with pass_all, but let us keep it just in case
+  lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sco3.2v5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+  
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  lt_cv_file_magic_test_file=/lib/libc.so
+  ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+  case "$host_vendor" in
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  esac
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+AC_SUBST(file_magic_cmd)
+AC_SUBST(deplibs_check_method)
+])
+
+
 # AC_PROG_NM - find the path to a BSD-compatible name lister
 AC_DEFUN(AC_PROG_NM,
 [AC_MSG_CHECKING([for BSD-compatible nm])
index 92fa4fa688dc6fa22744580d8c8857a1bb8e9526..8575e58e254bd4b076b2dfe7e0c82df532c05149 100755 (executable)
@@ -1434,13 +1434,11 @@ else
   echo "${ac_t}no" 1>&6
 fi
 
-reload_flag=
+reload_flag=@reload_flag@
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
-echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6
-# PORTME Some linkers may need a different reload flag.
-reload_flag='-r'
-echo "$ac_t$reload_flag" 1>&6
-test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+file_magic_cmd=@file_magic_cmd@
+deplibs_check_method=@deplibs_check_method@
 
 # PORTME Fill in your ld.so characteristics
 library_names_spec=
@@ -1456,19 +1454,7 @@ version_type=none
 dynamic_linker="$host_os ld.so"
 sys_lib_dlsearch_path_spec="/lib /usr/lib"
 sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-file_magic_cmd="$FILE"
-file_magic_test_file=
-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 know.
-# 'pass_all' -- all dependencies passed with no checks.
-# 'test_compile' -- check by making test program.
-# 'file_magic [regex]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd 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*)
@@ -1489,7 +1475,6 @@ aix4*)
   # and later linker supports .so
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a'
   shlibpath_var=LIBPATH
-  deplibs_check_method=pass_all
   ;;
 
 amigaos*)
@@ -1502,7 +1487,6 @@ beos*)
   library_names_spec='${libname}.so'
   dynamic_linker="$host_os ld.so"
   shlibpath_var=LIBRARY_PATH
-  deplibs_check_method=pass_all
   lt_cv_dlopen="load_add_on"
   lt_cv_dlopen_libs=
   lt_cv_dlopen_self=yes
@@ -1515,8 +1499,6 @@ bsdi4*)
   soname_spec='${libname}${release}.so$major'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
   shlibpath_var=LD_LIBRARY_PATH
-  deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
-  file_magic_test_file=/shlib/libc.so
   sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
   sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
   export_dynamic_flag_spec=-rdynamic
@@ -1535,8 +1517,6 @@ cygwin* | mingw*)
     library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
   fi
   dynamic_linker='Win32 ld.exe'
-  deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
-  file_magic_cmd='${OBJDUMP} -f'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   lt_cv_dlopen="LoadLibrary"
@@ -1552,13 +1532,11 @@ freebsd*)
   version_type=freebsd-$objformat
   case "$version_type" in
     freebsd-elf*)
-      deplibs_check_method=pass_all
       library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
       need_version=no
       need_lib_prefix=no
       ;;
     freebsd-*)
-      deplibs_check_method=unknown
       library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
       need_version=yes
       ;;
@@ -1586,7 +1564,6 @@ gnu*)
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
   soname_spec='${libname}${release}.so$major'
   shlibpath_var=LD_LIBRARY_PATH
-  deplibs_check_method=pass_all
   ;;
 
 hpux9* | hpux10* | hpux11*)
@@ -1613,8 +1590,6 @@ irix5* | irix6*)
   case "$host_os" in
   irix5*)
     libsuff= shlibsuff=
-    # this will be overridden with pass_all, but let us keep it just in case
-    deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
     ;;
   *)
     case "$LD" in # libtool.m4 will add one of these switches to LD
@@ -1631,8 +1606,6 @@ irix5* | irix6*)
   shlibpath_overrides_runpath=no
   sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
   sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-  file_magic_test_file=`echo /lib${libsuff}/libc.so*`
-  deplibs_check_method=pass_all
   ;;
 
 # No shared lib support for Linux oldld, aout, or coff.
@@ -1651,15 +1624,6 @@ linux-gnu*)
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
 
-  case "$host_cpu" in
-  alpha* | i*86 | sparc* )
-    deplibs_check_method=pass_all ;;
-  *)
-    # glibc up to 2.1.1 does not perform some relocations on ARM
-    deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
-  esac
-  file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
-
   if test -f /lib/ld.so.1; then
     dynamic_linker='GNU ld.so'
   else
@@ -1710,10 +1674,6 @@ osf3* | osf4* | osf5*)
   soname_spec='${libname}${release}.so'
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
   shlibpath_var=LD_LIBRARY_PATH
-  # this will be overridden with pass_all, but let us keep it just in case
-  deplibs_check_method='file_magic COFF format alpha shared library'
-  file_magic_test_file=/shlib/libc.so
-  deplibs_check_method=pass_all
   sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
   sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
   ;;
@@ -1723,7 +1683,6 @@ sco3.2v5*)
   soname_spec='${libname}${release}.so$major'
   library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
   shlibpath_var=LD_LIBRARY_PATH
-  deplibs_check_method=pass_all
   ;;
 
 solaris*)
@@ -1736,8 +1695,6 @@ solaris*)
   shlibpath_overrides_runpath=yes
   # ldd complains unless libraries are executable
   postinstall_cmds='chmod +x $lib'
-  deplibs_check_method=pass_all
-  file_magic_test_file=/lib/libc.so
   ;;
 
 sunos4*)
@@ -1758,16 +1715,11 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
   soname_spec='${libname}${release}.so$major'
   shlibpath_var=LD_LIBRARY_PATH
   case "$host_vendor" in
-    ncr)
-      deplibs_check_method=pass_all
-      ;;
     motorola)
       need_lib_prefix=no
       need_version=no
       shlibpath_overrides_runpath=no
       sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
-      deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
-      file_magic_test_file=`echo /usr/lib/libc.so*`
       ;;
   esac
   ;;
@@ -1979,30 +1931,6 @@ cygwin* | mingw* | os2*)
 ;;
 esac
 
-if test -n "$file_magic_test_file"; then
-  case "$deplibs_check_method" in
-  "file_magic "*)
-    file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
-    if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
-       egrep "$file_magic_regex" > /dev/null; then
-      :
-    else
-      cat <<EOF 1>&2
-
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such.  This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem.  Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool@gnu.org
-
-EOF
-    fi ;;
-  esac
-fi
-
 echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
 test "$can_build_shared" = "no" && enable_shared=no