From a35db605a0bfa6ba592dc17c62ac1b75ca7fd950 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 2 Jan 2007 20:52:16 +0000 Subject: Improve support for OpenBSD. --- autoconf-lib-link/ChangeLog | 6 ++ autoconf-lib-link/config.rpath | 46 ++++++++++++++++ autoconf-lib-link/m4/ChangeLog | 7 +++ autoconf-lib-link/m4/lib-link.m4 | 116 +++++++++++++++++++++++++++------------ 4 files changed, 140 insertions(+), 35 deletions(-) (limited to 'autoconf-lib-link') diff --git a/autoconf-lib-link/ChangeLog b/autoconf-lib-link/ChangeLog index 8e4e537..2124e55 100644 --- a/autoconf-lib-link/ChangeLog +++ b/autoconf-lib-link/ChangeLog @@ -1,3 +1,9 @@ +2006-12-24 Bruno Haible + + Improve support for OpenBSD. + * config.rpath (libname_spec): Export. + (library_names_spec): New variable. Export. + 2006-10-27 Bruno Haible Work around automake-1.10 annoyance. diff --git a/autoconf-lib-link/config.rpath b/autoconf-lib-link/config.rpath index c492a93..e082db6 100755 --- a/autoconf-lib-link/config.rpath +++ b/autoconf-lib-link/config.rpath @@ -488,33 +488,54 @@ fi # Check dynamic linker characteristics # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. +# Unlike libtool.m4, here we don't care about _all_ names of the library, but +# only about the one the linker finds when passed -lNAME. This is the last +# element of library_names_spec in libtool.m4, or possibly two of them if the +# linker has special search rules. +library_names_spec= # the last element of library_names_spec in libtool.m4 libname_spec='lib$name' case "$host_os" in aix3*) + library_names_spec='$libname.a' ;; aix4* | aix5*) + library_names_spec='$libname$shrext' ;; amigaos*) + library_names_spec='$libname.a' ;; beos*) + library_names_spec='$libname$shrext' ;; bsdi[45]*) + library_names_spec='$libname$shrext' ;; cygwin* | mingw* | pw32*) shrext=.dll + library_names_spec='$libname.dll.a $libname.lib' ;; darwin* | rhapsody*) shrext=.dylib + library_names_spec='$libname$shrext' ;; dgux*) + library_names_spec='$libname$shrext' ;; freebsd1*) ;; kfreebsd*-gnu) + library_names_spec='$libname$shrext' ;; freebsd* | dragonfly*) + case "$host_os" in + freebsd[123]*) + library_names_spec='$libname$shrext$versuffix' ;; + *) + library_names_spec='$libname$shrext' ;; + esac ;; gnu*) + library_names_spec='$libname$shrext' ;; hpux9* | hpux10* | hpux11*) case $host_cpu in @@ -528,10 +549,13 @@ case "$host_os" in shrext=.sl ;; esac + library_names_spec='$libname$shrext' ;; interix3*) + library_names_spec='$libname$shrext' ;; irix5* | irix6* | nonstopux*) + library_names_spec='$libname$shrext' case "$host_os" in irix5* | nonstopux*) libsuff= shlibsuff= @@ -549,40 +573,56 @@ case "$host_os" in linux*oldld* | linux*aout* | linux*coff*) ;; linux*) + library_names_spec='$libname$shrext' ;; knetbsd*-gnu) + library_names_spec='$libname$shrext' ;; netbsd*) + library_names_spec='$libname$shrext' ;; newsos6) + library_names_spec='$libname$shrext' ;; nto-qnx*) + library_names_spec='$libname$shrext' ;; openbsd*) + library_names_spec='$libname$shrext$versuffix' ;; os2*) libname_spec='$name' shrext=.dll + library_names_spec='$libname.a' ;; osf3* | osf4* | osf5*) + library_names_spec='$libname$shrext' ;; solaris*) + library_names_spec='$libname$shrext' ;; sunos4*) + library_names_spec='$libname$shrext$versuffix' ;; sysv4 | sysv4.3*) + library_names_spec='$libname$shrext' ;; sysv4*MP*) + library_names_spec='$libname$shrext' ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + library_names_spec='$libname$shrext' ;; uts4*) + library_names_spec='$libname$shrext' ;; esac sed_quote_subst='s/\(["`$\\]\)/\\\1/g' escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' < + + Improve support for OpenBSD. + * lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Extract libname_spec and + library_names_spec from the config.rpath output. Locate shared library + through the name pattern in library_names_spec. + 2006-11-12 Bruno Haible * lib-link.m4 (AC_LIB_LINKFLAGS, AC_LIB_HAVE_LINKFLAGS, diff --git a/autoconf-lib-link/m4/lib-link.m4 b/autoconf-lib-link/m4/lib-link.m4 index aae42ac..76503fe 100644 --- a/autoconf-lib-link/m4/lib-link.m4 +++ b/autoconf-lib-link/m4/lib-link.m4 @@ -1,4 +1,4 @@ -# lib-link.m4 serial 10 (gettext-0.16.2) +# lib-link.m4 serial 11 (gettext-0.16.2) dnl Copyright (C) 2001-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -120,6 +120,8 @@ AC_DEFUN([AC_LIB_RPATH], wl="$acl_cv_wl" libext="$acl_cv_libext" shlibext="$acl_cv_shlibext" + libname_spec="$acl_cv_libname_spec" + library_names_spec="$acl_cv_library_names_spec" hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" hardcode_direct="$acl_cv_hardcode_direct" @@ -211,27 +213,53 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], found_la= found_so= found_a= + eval libname=\"$libname_spec\" # typically: libname=lib$name + if test -n "$shlibext"; then + shrext=".$shlibext" # typically: shrext=.so + else + shrext= + fi if test $use_additional = yes; then - if test -n "$shlibext" \ - && { test -f "$additional_libdir/lib$name.$shlibext" \ - || { test "$shlibext" = dll \ - && test -f "$additional_libdir/lib$name.dll.a"; }; }; then - found_dir="$additional_libdir" - if test -f "$additional_libdir/lib$name.$shlibext"; then - found_so="$additional_libdir/lib$name.$shlibext" + dir="$additional_libdir" + dnl The same code as in the loop below: + dnl First look for a shared library. + if test -n "$shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" else - found_so="$additional_libdir/lib$name.dll.a" + if test "$library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | tr '.' ' ' | sort -n -r -k1 -k2 -k3 -k4 -k5 | tr ' ' '.' \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi fi - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$libext"; then + found_dir="$dir" + found_a="$dir/$libname.$libext" fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" fi fi fi @@ -241,26 +269,44 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" \ - && { test -f "$dir/lib$name.$shlibext" \ - || { test "$shlibext" = dll \ - && test -f "$dir/lib$name.dll.a"; }; }; then - found_dir="$dir" - if test -f "$dir/lib$name.$shlibext"; then - found_so="$dir/lib$name.$shlibext" + dnl First look for a shared library. + if test -n "$shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" else - found_so="$dir/lib$name.dll.a" - fi - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" + if test "$library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | tr '.' ' ' | sort -n -r -k1 -k2 -k3 -k4 -k5 | tr ' ' '.' \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi fi - else - if test -f "$dir/lib$name.$libext"; then + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$libext"; then found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi + found_a="$dir/$libname.$libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" fi fi ;; -- cgit v1.1