Blame m4/lib-link.m4

Packit 549fdc
# lib-link.m4 serial 26 (gettext-0.18.2)
Packit 549fdc
dnl Copyright (C) 2001-2014 Free Software Foundation, Inc.
Packit 549fdc
dnl This file is free software; the Free Software Foundation
Packit 549fdc
dnl gives unlimited permission to copy and/or distribute it,
Packit 549fdc
dnl with or without modifications, as long as this notice is preserved.
Packit 549fdc
Packit 549fdc
dnl From Bruno Haible.
Packit 549fdc
Packit 549fdc
AC_PREREQ([2.54])
Packit 549fdc
Packit 549fdc
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
Packit 549fdc
dnl the libraries corresponding to explicit and implicit dependencies.
Packit 549fdc
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
Packit 549fdc
dnl augments the CPPFLAGS variable.
Packit 549fdc
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
Packit 549fdc
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
Packit 549fdc
AC_DEFUN([AC_LIB_LINKFLAGS],
Packit 549fdc
[
Packit 549fdc
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
Packit 549fdc
  AC_REQUIRE([AC_LIB_RPATH])
Packit 549fdc
  pushdef([Name],[m4_translit([$1],[./+-], [____])])
Packit 549fdc
  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
Packit 549fdc
                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
Packit 549fdc
  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
Packit 549fdc
    AC_LIB_LINKFLAGS_BODY([$1], [$2])
Packit 549fdc
    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
Packit 549fdc
    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
Packit 549fdc
    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
Packit 549fdc
    ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
Packit 549fdc
  ])
Packit 549fdc
  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
Packit 549fdc
  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
Packit 549fdc
  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
Packit 549fdc
  LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
Packit 549fdc
  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
Packit 549fdc
  AC_SUBST([LIB]NAME)
Packit 549fdc
  AC_SUBST([LTLIB]NAME)
Packit 549fdc
  AC_SUBST([LIB]NAME[_PREFIX])
Packit 549fdc
  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
Packit 549fdc
  dnl results of this search when this library appears as a dependency.
Packit 549fdc
  HAVE_LIB[]NAME=yes
Packit 549fdc
  popdef([NAME])
Packit 549fdc
  popdef([Name])
Packit 549fdc
])
Packit 549fdc
Packit 549fdc
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
Packit 549fdc
dnl searches for libname and the libraries corresponding to explicit and
Packit 549fdc
dnl implicit dependencies, together with the specified include files and
Packit 549fdc
dnl the ability to compile and link the specified testcode. The missing-message
Packit 549fdc
dnl defaults to 'no' and may contain additional hints for the user.
Packit 549fdc
dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
Packit 549fdc
dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
Packit 549fdc
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
Packit 549fdc
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
Packit 549fdc
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
Packit 549fdc
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
Packit 549fdc
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
Packit 549fdc
[
Packit 549fdc
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
Packit 549fdc
  AC_REQUIRE([AC_LIB_RPATH])
Packit 549fdc
  pushdef([Name],[m4_translit([$1],[./+-], [____])])
Packit 549fdc
  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
Packit 549fdc
                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
Packit 549fdc
Packit 549fdc
  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
Packit 549fdc
  dnl accordingly.
Packit 549fdc
  AC_LIB_LINKFLAGS_BODY([$1], [$2])
Packit 549fdc
Packit 549fdc
  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
Packit 549fdc
  dnl because if the user has installed lib[]Name and not disabled its use
Packit 549fdc
  dnl via --without-lib[]Name-prefix, he wants to use it.
Packit 549fdc
  ac_save_CPPFLAGS="$CPPFLAGS"
Packit 549fdc
  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
Packit 549fdc
Packit 549fdc
  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
Packit 549fdc
    ac_save_LIBS="$LIBS"
Packit 549fdc
    dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
Packit 549fdc
    dnl because these -l options might require -L options that are present in
Packit 549fdc
    dnl LIBS. -l options benefit only from the -L options listed before it.
Packit 549fdc
    dnl Otherwise, add it to the front of LIBS, because it may be a static
Packit 549fdc
    dnl library that depends on another static library that is present in LIBS.
Packit 549fdc
    dnl Static libraries benefit only from the static libraries listed after
Packit 549fdc
    dnl it.
Packit 549fdc
    case " $LIB[]NAME" in
Packit 549fdc
      *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
Packit 549fdc
      *)       LIBS="$LIB[]NAME $LIBS" ;;
Packit 549fdc
    esac
Packit 549fdc
    AC_LINK_IFELSE(
Packit 549fdc
      [AC_LANG_PROGRAM([[$3]], [[$4]])],
Packit 549fdc
      [ac_cv_lib[]Name=yes],
Packit 549fdc
      [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
Packit 549fdc
    LIBS="$ac_save_LIBS"
Packit 549fdc
  ])
Packit 549fdc
  if test "$ac_cv_lib[]Name" = yes; then
Packit 549fdc
    HAVE_LIB[]NAME=yes
Packit 549fdc
    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
Packit 549fdc
    AC_MSG_CHECKING([how to link with lib[]$1])
Packit 549fdc
    AC_MSG_RESULT([$LIB[]NAME])
Packit 549fdc
  else
Packit 549fdc
    HAVE_LIB[]NAME=no
Packit 549fdc
    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
Packit 549fdc
    dnl $INC[]NAME either.
Packit 549fdc
    CPPFLAGS="$ac_save_CPPFLAGS"
Packit 549fdc
    LIB[]NAME=
Packit 549fdc
    LTLIB[]NAME=
Packit 549fdc
    LIB[]NAME[]_PREFIX=
Packit 549fdc
  fi
Packit 549fdc
  AC_SUBST([HAVE_LIB]NAME)
Packit 549fdc
  AC_SUBST([LIB]NAME)
Packit 549fdc
  AC_SUBST([LTLIB]NAME)
Packit 549fdc
  AC_SUBST([LIB]NAME[_PREFIX])
Packit 549fdc
  popdef([NAME])
Packit 549fdc
  popdef([Name])
Packit 549fdc
])
Packit 549fdc
Packit 549fdc
dnl Determine the platform dependent parameters needed to use rpath:
Packit 549fdc
dnl   acl_libext,
Packit 549fdc
dnl   acl_shlibext,
Packit 549fdc
dnl   acl_libname_spec,
Packit 549fdc
dnl   acl_library_names_spec,
Packit 549fdc
dnl   acl_hardcode_libdir_flag_spec,
Packit 549fdc
dnl   acl_hardcode_libdir_separator,
Packit 549fdc
dnl   acl_hardcode_direct,
Packit 549fdc
dnl   acl_hardcode_minus_L.
Packit 549fdc
AC_DEFUN([AC_LIB_RPATH],
Packit 549fdc
[
Packit 549fdc
  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
Packit 549fdc
  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
Packit 549fdc
  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
Packit 549fdc
  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
Packit 549fdc
  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
Packit 549fdc
  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
Packit 549fdc
  AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
Packit 549fdc
    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
Packit 549fdc
    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
Packit 549fdc
    . ./conftest.sh
Packit 549fdc
    rm -f ./conftest.sh
Packit 549fdc
    acl_cv_rpath=done
Packit 549fdc
  ])
Packit 549fdc
  wl="$acl_cv_wl"
Packit 549fdc
  acl_libext="$acl_cv_libext"
Packit 549fdc
  acl_shlibext="$acl_cv_shlibext"
Packit 549fdc
  acl_libname_spec="$acl_cv_libname_spec"
Packit 549fdc
  acl_library_names_spec="$acl_cv_library_names_spec"
Packit 549fdc
  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
Packit 549fdc
  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
Packit 549fdc
  acl_hardcode_direct="$acl_cv_hardcode_direct"
Packit 549fdc
  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
Packit 549fdc
  dnl Determine whether the user wants rpath handling at all.
Packit 549fdc
  AC_ARG_ENABLE([rpath],
Packit 549fdc
    [  --disable-rpath         do not hardcode runtime library paths],
Packit 549fdc
    :, enable_rpath=yes)
Packit 549fdc
])
Packit 549fdc
Packit 549fdc
dnl AC_LIB_FROMPACKAGE(name, package)
Packit 549fdc
dnl declares that libname comes from the given package. The configure file
Packit 549fdc
dnl will then not have a --with-libname-prefix option but a
Packit 549fdc
dnl --with-package-prefix option. Several libraries can come from the same
Packit 549fdc
dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
Packit 549fdc
dnl macro call that searches for libname.
Packit 549fdc
AC_DEFUN([AC_LIB_FROMPACKAGE],
Packit 549fdc
[
Packit 549fdc
  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
Packit 549fdc
                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
Packit 549fdc
  define([acl_frompackage_]NAME, [$2])
Packit 549fdc
  popdef([NAME])
Packit 549fdc
  pushdef([PACK],[$2])
Packit 549fdc
  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
Packit 549fdc
                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
Packit 549fdc
  define([acl_libsinpackage_]PACKUP,
Packit 549fdc
    m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
Packit 549fdc
  popdef([PACKUP])
Packit 549fdc
  popdef([PACK])
Packit 549fdc
])
Packit 549fdc
Packit 549fdc
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
Packit 549fdc
dnl the libraries corresponding to explicit and implicit dependencies.
Packit 549fdc
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
Packit 549fdc
dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
Packit 549fdc
dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
Packit 549fdc
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
Packit 549fdc
[
Packit 549fdc
  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
Packit 549fdc
  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
Packit 549fdc
                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
Packit 549fdc
  pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
Packit 549fdc
  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
Packit 549fdc
                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
Packit 549fdc
  pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
Packit 549fdc
  dnl Autoconf >= 2.61 supports dots in --with options.
Packit 549fdc
  pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)])
Packit 549fdc
  dnl By default, look in $includedir and $libdir.
Packit 549fdc
  use_additional=yes
Packit 549fdc
  AC_LIB_WITH_FINAL_PREFIX([
Packit 549fdc
    eval additional_includedir=\"$includedir\"
Packit 549fdc
    eval additional_libdir=\"$libdir\"
Packit 549fdc
  ])
Packit 549fdc
  AC_ARG_WITH(P_A_C_K[-prefix],
Packit 549fdc
[[  --with-]]P_A_C_K[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and DIR/lib
Packit 549fdc
  --without-]]P_A_C_K[[-prefix     don't search for ]PACKLIBS[ in includedir and libdir]],
Packit 549fdc
[
Packit 549fdc
    if test "X$withval" = "Xno"; then
Packit 549fdc
      use_additional=no
Packit 549fdc
    else
Packit 549fdc
      if test "X$withval" = "X"; then
Packit 549fdc
        AC_LIB_WITH_FINAL_PREFIX([
Packit 549fdc
          eval additional_includedir=\"$includedir\"
Packit 549fdc
          eval additional_libdir=\"$libdir\"
Packit 549fdc
        ])
Packit 549fdc
      else
Packit 549fdc
        additional_includedir="$withval/include"
Packit 549fdc
        additional_libdir="$withval/$acl_libdirstem"
Packit 549fdc
        if test "$acl_libdirstem2" != "$acl_libdirstem" \
Packit 549fdc
           && ! test -d "$withval/$acl_libdirstem"; then
Packit 549fdc
          additional_libdir="$withval/$acl_libdirstem2"
Packit 549fdc
        fi
Packit 549fdc
      fi
Packit 549fdc
    fi
Packit 549fdc
])
Packit 549fdc
  dnl Search the library and its dependencies in $additional_libdir and
Packit 549fdc
  dnl $LDFLAGS. Using breadth-first-seach.
Packit 549fdc
  LIB[]NAME=
Packit 549fdc
  LTLIB[]NAME=
Packit 549fdc
  INC[]NAME=
Packit 549fdc
  LIB[]NAME[]_PREFIX=
Packit 549fdc
  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
Packit 549fdc
  dnl computed. So it has to be reset here.
Packit 549fdc
  HAVE_LIB[]NAME=
Packit 549fdc
  rpathdirs=
Packit 549fdc
  ltrpathdirs=
Packit 549fdc
  names_already_handled=
Packit 549fdc
  names_next_round='$1 $2'
Packit 549fdc
  while test -n "$names_next_round"; do
Packit 549fdc
    names_this_round="$names_next_round"
Packit 549fdc
    names_next_round=
Packit 549fdc
    for name in $names_this_round; do
Packit 549fdc
      already_handled=
Packit 549fdc
      for n in $names_already_handled; do
Packit 549fdc
        if test "$n" = "$name"; then
Packit 549fdc
          already_handled=yes
Packit 549fdc
          break
Packit 549fdc
        fi
Packit 549fdc
      done
Packit 549fdc
      if test -z "$already_handled"; then
Packit 549fdc
        names_already_handled="$names_already_handled $name"
Packit 549fdc
        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
Packit 549fdc
        dnl or AC_LIB_HAVE_LINKFLAGS call.
Packit 549fdc
        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
Packit 549fdc
        eval value=\"\$HAVE_LIB$uppername\"
Packit 549fdc
        if test -n "$value"; then
Packit 549fdc
          if test "$value" = yes; then
Packit 549fdc
            eval value=\"\$LIB$uppername\"
Packit 549fdc
            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
Packit 549fdc
            eval value=\"\$LTLIB$uppername\"
Packit 549fdc
            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
Packit 549fdc
          else
Packit 549fdc
            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
Packit 549fdc
            dnl that this library doesn't exist. So just drop it.
Packit 549fdc
            :
Packit 549fdc
          fi
Packit 549fdc
        else
Packit 549fdc
          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
Packit 549fdc
          dnl and the already constructed $LIBNAME/$LTLIBNAME.
Packit 549fdc
          found_dir=
Packit 549fdc
          found_la=
Packit 549fdc
          found_so=
Packit 549fdc
          found_a=
Packit 549fdc
          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
Packit 549fdc
          if test -n "$acl_shlibext"; then
Packit 549fdc
            shrext=".$acl_shlibext"             # typically: shrext=.so
Packit 549fdc
          else
Packit 549fdc
            shrext=
Packit 549fdc
          fi
Packit 549fdc
          if test $use_additional = yes; then
Packit 549fdc
            dir="$additional_libdir"
Packit 549fdc
            dnl The same code as in the loop below:
Packit 549fdc
            dnl First look for a shared library.
Packit 549fdc
            if test -n "$acl_shlibext"; then
Packit 549fdc
              if test -f "$dir/$libname$shrext"; then
Packit 549fdc
                found_dir="$dir"
Packit 549fdc
                found_so="$dir/$libname$shrext"
Packit 549fdc
              else
Packit 549fdc
                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
Packit 549fdc
                  ver=`(cd "$dir" && \
Packit 549fdc
                        for f in "$libname$shrext".*; do echo "$f"; done \
Packit 549fdc
                        | sed -e "s,^$libname$shrext\\\\.,," \
Packit 549fdc
                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
Packit 549fdc
                        | sed 1q ) 2>/dev/null`
Packit 549fdc
                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
Packit 549fdc
                    found_dir="$dir"
Packit 549fdc
                    found_so="$dir/$libname$shrext.$ver"
Packit 549fdc
                  fi
Packit 549fdc
                else
Packit 549fdc
                  eval library_names=\"$acl_library_names_spec\"
Packit 549fdc
                  for f in $library_names; do
Packit 549fdc
                    if test -f "$dir/$f"; then
Packit 549fdc
                      found_dir="$dir"
Packit 549fdc
                      found_so="$dir/$f"
Packit 549fdc
                      break
Packit 549fdc
                    fi
Packit 549fdc
                  done
Packit 549fdc
                fi
Packit 549fdc
              fi
Packit 549fdc
            fi
Packit 549fdc
            dnl Then look for a static library.
Packit 549fdc
            if test "X$found_dir" = "X"; then
Packit 549fdc
              if test -f "$dir/$libname.$acl_libext"; then
Packit 549fdc
                found_dir="$dir"
Packit 549fdc
                found_a="$dir/$libname.$acl_libext"
Packit 549fdc
              fi
Packit 549fdc
            fi
Packit 549fdc
            if test "X$found_dir" != "X"; then
Packit 549fdc
              if test -f "$dir/$libname.la"; then
Packit 549fdc
                found_la="$dir/$libname.la"
Packit 549fdc
              fi
Packit 549fdc
            fi
Packit 549fdc
          fi
Packit 549fdc
          if test "X$found_dir" = "X"; then
Packit 549fdc
            for x in $LDFLAGS $LTLIB[]NAME; do
Packit 549fdc
              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
Packit 549fdc
              case "$x" in
Packit 549fdc
                -L*)
Packit 549fdc
                  dir=`echo "X$x" | sed -e 's/^X-L//'`
Packit 549fdc
                  dnl First look for a shared library.
Packit 549fdc
                  if test -n "$acl_shlibext"; then
Packit 549fdc
                    if test -f "$dir/$libname$shrext"; then
Packit 549fdc
                      found_dir="$dir"
Packit 549fdc
                      found_so="$dir/$libname$shrext"
Packit 549fdc
                    else
Packit 549fdc
                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
Packit 549fdc
                        ver=`(cd "$dir" && \
Packit 549fdc
                              for f in "$libname$shrext".*; do echo "$f"; done \
Packit 549fdc
                              | sed -e "s,^$libname$shrext\\\\.,," \
Packit 549fdc
                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
Packit 549fdc
                              | sed 1q ) 2>/dev/null`
Packit 549fdc
                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
Packit 549fdc
                          found_dir="$dir"
Packit 549fdc
                          found_so="$dir/$libname$shrext.$ver"
Packit 549fdc
                        fi
Packit 549fdc
                      else
Packit 549fdc
                        eval library_names=\"$acl_library_names_spec\"
Packit 549fdc
                        for f in $library_names; do
Packit 549fdc
                          if test -f "$dir/$f"; then
Packit 549fdc
                            found_dir="$dir"
Packit 549fdc
                            found_so="$dir/$f"
Packit 549fdc
                            break
Packit 549fdc
                          fi
Packit 549fdc
                        done
Packit 549fdc
                      fi
Packit 549fdc
                    fi
Packit 549fdc
                  fi
Packit 549fdc
                  dnl Then look for a static library.
Packit 549fdc
                  if test "X$found_dir" = "X"; then
Packit 549fdc
                    if test -f "$dir/$libname.$acl_libext"; then
Packit 549fdc
                      found_dir="$dir"
Packit 549fdc
                      found_a="$dir/$libname.$acl_libext"
Packit 549fdc
                    fi
Packit 549fdc
                  fi
Packit 549fdc
                  if test "X$found_dir" != "X"; then
Packit 549fdc
                    if test -f "$dir/$libname.la"; then
Packit 549fdc
                      found_la="$dir/$libname.la"
Packit 549fdc
                    fi
Packit 549fdc
                  fi
Packit 549fdc
                  ;;
Packit 549fdc
              esac
Packit 549fdc
              if test "X$found_dir" != "X"; then
Packit 549fdc
                break
Packit 549fdc
              fi
Packit 549fdc
            done
Packit 549fdc
          fi
Packit 549fdc
          if test "X$found_dir" != "X"; then
Packit 549fdc
            dnl Found the library.
Packit 549fdc
            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
Packit 549fdc
            if test "X$found_so" != "X"; then
Packit 549fdc
              dnl Linking with a shared library. We attempt to hardcode its
Packit 549fdc
              dnl directory into the executable's runpath, unless it's the
Packit 549fdc
              dnl standard /usr/lib.
Packit 549fdc
              if test "$enable_rpath" = no \
Packit 549fdc
                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
Packit 549fdc
                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
Packit 549fdc
                dnl No hardcoding is needed.
Packit 549fdc
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
Packit 549fdc
              else
Packit 549fdc
                dnl Use an explicit option to hardcode DIR into the resulting
Packit 549fdc
                dnl binary.
Packit 549fdc
                dnl Potentially add DIR to ltrpathdirs.
Packit 549fdc
                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
Packit 549fdc
                haveit=
Packit 549fdc
                for x in $ltrpathdirs; do
Packit 549fdc
                  if test "X$x" = "X$found_dir"; then
Packit 549fdc
                    haveit=yes
Packit 549fdc
                    break
Packit 549fdc
                  fi
Packit 549fdc
                done
Packit 549fdc
                if test -z "$haveit"; then
Packit 549fdc
                  ltrpathdirs="$ltrpathdirs $found_dir"
Packit 549fdc
                fi
Packit 549fdc
                dnl The hardcoding into $LIBNAME is system dependent.
Packit 549fdc
                if test "$acl_hardcode_direct" = yes; then
Packit 549fdc
                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
Packit 549fdc
                  dnl resulting binary.
Packit 549fdc
                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
Packit 549fdc
                else
Packit 549fdc
                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
Packit 549fdc
                    dnl Use an explicit option to hardcode DIR into the resulting
Packit 549fdc
                    dnl binary.
Packit 549fdc
                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
Packit 549fdc
                    dnl Potentially add DIR to rpathdirs.
Packit 549fdc
                    dnl The rpathdirs will be appended to $LIBNAME at the end.
Packit 549fdc
                    haveit=
Packit 549fdc
                    for x in $rpathdirs; do
Packit 549fdc
                      if test "X$x" = "X$found_dir"; then
Packit 549fdc
                        haveit=yes
Packit 549fdc
                        break
Packit 549fdc
                      fi
Packit 549fdc
                    done
Packit 549fdc
                    if test -z "$haveit"; then
Packit 549fdc
                      rpathdirs="$rpathdirs $found_dir"
Packit 549fdc
                    fi
Packit 549fdc
                  else
Packit 549fdc
                    dnl Rely on "-L$found_dir".
Packit 549fdc
                    dnl But don't add it if it's already contained in the LDFLAGS
Packit 549fdc
                    dnl or the already constructed $LIBNAME
Packit 549fdc
                    haveit=
Packit 549fdc
                    for x in $LDFLAGS $LIB[]NAME; do
Packit 549fdc
                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
Packit 549fdc
                      if test "X$x" = "X-L$found_dir"; then
Packit 549fdc
                        haveit=yes
Packit 549fdc
                        break
Packit 549fdc
                      fi
Packit 549fdc
                    done
Packit 549fdc
                    if test -z "$haveit"; then
Packit 549fdc
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
Packit 549fdc
                    fi
Packit 549fdc
                    if test "$acl_hardcode_minus_L" != no; then
Packit 549fdc
                      dnl FIXME: Not sure whether we should use
Packit 549fdc
                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
Packit 549fdc
                      dnl here.
Packit 549fdc
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
Packit 549fdc
                    else
Packit 549fdc
                      dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
Packit 549fdc
                      dnl here, because this doesn't fit in flags passed to the
Packit 549fdc
                      dnl compiler. So give up. No hardcoding. This affects only
Packit 549fdc
                      dnl very old systems.
Packit 549fdc
                      dnl FIXME: Not sure whether we should use
Packit 549fdc
                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
Packit 549fdc
                      dnl here.
Packit 549fdc
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
Packit 549fdc
                    fi
Packit 549fdc
                  fi
Packit 549fdc
                fi
Packit 549fdc
              fi
Packit 549fdc
            else
Packit 549fdc
              if test "X$found_a" != "X"; then
Packit 549fdc
                dnl Linking with a static library.
Packit 549fdc
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
Packit 549fdc
              else
Packit 549fdc
                dnl We shouldn't come here, but anyway it's good to have a
Packit 549fdc
                dnl fallback.
Packit 549fdc
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
Packit 549fdc
              fi
Packit 549fdc
            fi
Packit 549fdc
            dnl Assume the include files are nearby.
Packit 549fdc
            additional_includedir=
Packit 549fdc
            case "$found_dir" in
Packit 549fdc
              */$acl_libdirstem | */$acl_libdirstem/)
Packit 549fdc
                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
Packit 549fdc
                if test "$name" = '$1'; then
Packit 549fdc
                  LIB[]NAME[]_PREFIX="$basedir"
Packit 549fdc
                fi
Packit 549fdc
                additional_includedir="$basedir/include"
Packit 549fdc
                ;;
Packit 549fdc
              */$acl_libdirstem2 | */$acl_libdirstem2/)
Packit 549fdc
                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
Packit 549fdc
                if test "$name" = '$1'; then
Packit 549fdc
                  LIB[]NAME[]_PREFIX="$basedir"
Packit 549fdc
                fi
Packit 549fdc
                additional_includedir="$basedir/include"
Packit 549fdc
                ;;
Packit 549fdc
            esac
Packit 549fdc
            if test "X$additional_includedir" != "X"; then
Packit 549fdc
              dnl Potentially add $additional_includedir to $INCNAME.
Packit 549fdc
              dnl But don't add it
Packit 549fdc
              dnl   1. if it's the standard /usr/include,
Packit 549fdc
              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
Packit 549fdc
              dnl   3. if it's already present in $CPPFLAGS or the already
Packit 549fdc
              dnl      constructed $INCNAME,
Packit 549fdc
              dnl   4. if it doesn't exist as a directory.
Packit 549fdc
              if test "X$additional_includedir" != "X/usr/include"; then
Packit 549fdc
                haveit=
Packit 549fdc
                if test "X$additional_includedir" = "X/usr/local/include"; then
Packit 549fdc
                  if test -n "$GCC"; then
Packit 549fdc
                    case $host_os in
Packit 549fdc
                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
Packit 549fdc
                    esac
Packit 549fdc
                  fi
Packit 549fdc
                fi
Packit 549fdc
                if test -z "$haveit"; then
Packit 549fdc
                  for x in $CPPFLAGS $INC[]NAME; do
Packit 549fdc
                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
Packit 549fdc
                    if test "X$x" = "X-I$additional_includedir"; then
Packit 549fdc
                      haveit=yes
Packit 549fdc
                      break
Packit 549fdc
                    fi
Packit 549fdc
                  done
Packit 549fdc
                  if test -z "$haveit"; then
Packit 549fdc
                    if test -d "$additional_includedir"; then
Packit 549fdc
                      dnl Really add $additional_includedir to $INCNAME.
Packit 549fdc
                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
Packit 549fdc
                    fi
Packit 549fdc
                  fi
Packit 549fdc
                fi
Packit 549fdc
              fi
Packit 549fdc
            fi
Packit 549fdc
            dnl Look for dependencies.
Packit 549fdc
            if test -n "$found_la"; then
Packit 549fdc
              dnl Read the .la file. It defines the variables
Packit 549fdc
              dnl dlname, library_names, old_library, dependency_libs, current,
Packit 549fdc
              dnl age, revision, installed, dlopen, dlpreopen, libdir.
Packit 549fdc
              save_libdir="$libdir"
Packit 549fdc
              case "$found_la" in
Packit 549fdc
                */* | *\\*) . "$found_la" ;;
Packit 549fdc
                *) . "./$found_la" ;;
Packit 549fdc
              esac
Packit 549fdc
              libdir="$save_libdir"
Packit 549fdc
              dnl We use only dependency_libs.
Packit 549fdc
              for dep in $dependency_libs; do
Packit 549fdc
                case "$dep" in
Packit 549fdc
                  -L*)
Packit 549fdc
                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
Packit 549fdc
                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
Packit 549fdc
                    dnl But don't add it
Packit 549fdc
                    dnl   1. if it's the standard /usr/lib,
Packit 549fdc
                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
Packit 549fdc
                    dnl   3. if it's already present in $LDFLAGS or the already
Packit 549fdc
                    dnl      constructed $LIBNAME,
Packit 549fdc
                    dnl   4. if it doesn't exist as a directory.
Packit 549fdc
                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
Packit 549fdc
                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
Packit 549fdc
                      haveit=
Packit 549fdc
                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
Packit 549fdc
                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
Packit 549fdc
                        if test -n "$GCC"; then
Packit 549fdc
                          case $host_os in
Packit 549fdc
                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
Packit 549fdc
                          esac
Packit 549fdc
                        fi
Packit 549fdc
                      fi
Packit 549fdc
                      if test -z "$haveit"; then
Packit 549fdc
                        haveit=
Packit 549fdc
                        for x in $LDFLAGS $LIB[]NAME; do
Packit 549fdc
                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
Packit 549fdc
                          if test "X$x" = "X-L$additional_libdir"; then
Packit 549fdc
                            haveit=yes
Packit 549fdc
                            break
Packit 549fdc
                          fi
Packit 549fdc
                        done
Packit 549fdc
                        if test -z "$haveit"; then
Packit 549fdc
                          if test -d "$additional_libdir"; then
Packit 549fdc
                            dnl Really add $additional_libdir to $LIBNAME.
Packit 549fdc
                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
Packit 549fdc
                          fi
Packit 549fdc
                        fi
Packit 549fdc
                        haveit=
Packit 549fdc
                        for x in $LDFLAGS $LTLIB[]NAME; do
Packit 549fdc
                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
Packit 549fdc
                          if test "X$x" = "X-L$additional_libdir"; then
Packit 549fdc
                            haveit=yes
Packit 549fdc
                            break
Packit 549fdc
                          fi
Packit 549fdc
                        done
Packit 549fdc
                        if test -z "$haveit"; then
Packit 549fdc
                          if test -d "$additional_libdir"; then
Packit 549fdc
                            dnl Really add $additional_libdir to $LTLIBNAME.
Packit 549fdc
                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
Packit 549fdc
                          fi
Packit 549fdc
                        fi
Packit 549fdc
                      fi
Packit 549fdc
                    fi
Packit 549fdc
                    ;;
Packit 549fdc
                  -R*)
Packit 549fdc
                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
Packit 549fdc
                    if test "$enable_rpath" != no; then
Packit 549fdc
                      dnl Potentially add DIR to rpathdirs.
Packit 549fdc
                      dnl The rpathdirs will be appended to $LIBNAME at the end.
Packit 549fdc
                      haveit=
Packit 549fdc
                      for x in $rpathdirs; do
Packit 549fdc
                        if test "X$x" = "X$dir"; then
Packit 549fdc
                          haveit=yes
Packit 549fdc
                          break
Packit 549fdc
                        fi
Packit 549fdc
                      done
Packit 549fdc
                      if test -z "$haveit"; then
Packit 549fdc
                        rpathdirs="$rpathdirs $dir"
Packit 549fdc
                      fi
Packit 549fdc
                      dnl Potentially add DIR to ltrpathdirs.
Packit 549fdc
                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
Packit 549fdc
                      haveit=
Packit 549fdc
                      for x in $ltrpathdirs; do
Packit 549fdc
                        if test "X$x" = "X$dir"; then
Packit 549fdc
                          haveit=yes
Packit 549fdc
                          break
Packit 549fdc
                        fi
Packit 549fdc
                      done
Packit 549fdc
                      if test -z "$haveit"; then
Packit 549fdc
                        ltrpathdirs="$ltrpathdirs $dir"
Packit 549fdc
                      fi
Packit 549fdc
                    fi
Packit 549fdc
                    ;;
Packit 549fdc
                  -l*)
Packit 549fdc
                    dnl Handle this in the next round.
Packit 549fdc
                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
Packit 549fdc
                    ;;
Packit 549fdc
                  *.la)
Packit 549fdc
                    dnl Handle this in the next round. Throw away the .la's
Packit 549fdc
                    dnl directory; it is already contained in a preceding -L
Packit 549fdc
                    dnl option.
Packit 549fdc
                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
Packit 549fdc
                    ;;
Packit 549fdc
                  *)
Packit 549fdc
                    dnl Most likely an immediate library name.
Packit 549fdc
                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
Packit 549fdc
                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
Packit 549fdc
                    ;;
Packit 549fdc
                esac
Packit 549fdc
              done
Packit 549fdc
            fi
Packit 549fdc
          else
Packit 549fdc
            dnl Didn't find the library; assume it is in the system directories
Packit 549fdc
            dnl known to the linker and runtime loader. (All the system
Packit 549fdc
            dnl directories known to the linker should also be known to the
Packit 549fdc
            dnl runtime loader, otherwise the system is severely misconfigured.)
Packit 549fdc
            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
Packit 549fdc
            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
Packit 549fdc
          fi
Packit 549fdc
        fi
Packit 549fdc
      fi
Packit 549fdc
    done
Packit 549fdc
  done
Packit 549fdc
  if test "X$rpathdirs" != "X"; then
Packit 549fdc
    if test -n "$acl_hardcode_libdir_separator"; then
Packit 549fdc
      dnl Weird platform: only the last -rpath option counts, the user must
Packit 549fdc
      dnl pass all path elements in one option. We can arrange that for a
Packit 549fdc
      dnl single library, but not when more than one $LIBNAMEs are used.
Packit 549fdc
      alldirs=
Packit 549fdc
      for found_dir in $rpathdirs; do
Packit 549fdc
        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
Packit 549fdc
      done
Packit 549fdc
      dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
Packit 549fdc
      acl_save_libdir="$libdir"
Packit 549fdc
      libdir="$alldirs"
Packit 549fdc
      eval flag=\"$acl_hardcode_libdir_flag_spec\"
Packit 549fdc
      libdir="$acl_save_libdir"
Packit 549fdc
      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
Packit 549fdc
    else
Packit 549fdc
      dnl The -rpath options are cumulative.
Packit 549fdc
      for found_dir in $rpathdirs; do
Packit 549fdc
        acl_save_libdir="$libdir"
Packit 549fdc
        libdir="$found_dir"
Packit 549fdc
        eval flag=\"$acl_hardcode_libdir_flag_spec\"
Packit 549fdc
        libdir="$acl_save_libdir"
Packit 549fdc
        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
Packit 549fdc
      done
Packit 549fdc
    fi
Packit 549fdc
  fi
Packit 549fdc
  if test "X$ltrpathdirs" != "X"; then
Packit 549fdc
    dnl When using libtool, the option that works for both libraries and
Packit 549fdc
    dnl executables is -R. The -R options are cumulative.
Packit 549fdc
    for found_dir in $ltrpathdirs; do
Packit 549fdc
      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
Packit 549fdc
    done
Packit 549fdc
  fi
Packit 549fdc
  popdef([P_A_C_K])
Packit 549fdc
  popdef([PACKLIBS])
Packit 549fdc
  popdef([PACKUP])
Packit 549fdc
  popdef([PACK])
Packit 549fdc
  popdef([NAME])
Packit 549fdc
])
Packit 549fdc
Packit 549fdc
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
Packit 549fdc
dnl unless already present in VAR.
Packit 549fdc
dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
Packit 549fdc
dnl contains two or three consecutive elements that belong together.
Packit 549fdc
AC_DEFUN([AC_LIB_APPENDTOVAR],
Packit 549fdc
[
Packit 549fdc
  for element in [$2]; do
Packit 549fdc
    haveit=
Packit 549fdc
    for x in $[$1]; do
Packit 549fdc
      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
Packit 549fdc
      if test "X$x" = "X$element"; then
Packit 549fdc
        haveit=yes
Packit 549fdc
        break
Packit 549fdc
      fi
Packit 549fdc
    done
Packit 549fdc
    if test -z "$haveit"; then
Packit 549fdc
      [$1]="${[$1]}${[$1]:+ }$element"
Packit 549fdc
    fi
Packit 549fdc
  done
Packit 549fdc
])
Packit 549fdc
Packit 549fdc
dnl For those cases where a variable contains several -L and -l options
Packit 549fdc
dnl referring to unknown libraries and directories, this macro determines the
Packit 549fdc
dnl necessary additional linker options for the runtime path.
Packit 549fdc
dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
Packit 549fdc
dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
Packit 549fdc
dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
Packit 549fdc
dnl otherwise linking without libtool is assumed.
Packit 549fdc
AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
Packit 549fdc
[
Packit 549fdc
  AC_REQUIRE([AC_LIB_RPATH])
Packit 549fdc
  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
Packit 549fdc
  $1=
Packit 549fdc
  if test "$enable_rpath" != no; then
Packit 549fdc
    if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
Packit 549fdc
      dnl Use an explicit option to hardcode directories into the resulting
Packit 549fdc
      dnl binary.
Packit 549fdc
      rpathdirs=
Packit 549fdc
      next=
Packit 549fdc
      for opt in $2; do
Packit 549fdc
        if test -n "$next"; then
Packit 549fdc
          dir="$next"
Packit 549fdc
          dnl No need to hardcode the standard /usr/lib.
Packit 549fdc
          if test "X$dir" != "X/usr/$acl_libdirstem" \
Packit 549fdc
             && test "X$dir" != "X/usr/$acl_libdirstem2"; then
Packit 549fdc
            rpathdirs="$rpathdirs $dir"
Packit 549fdc
          fi
Packit 549fdc
          next=
Packit 549fdc
        else
Packit 549fdc
          case $opt in
Packit 549fdc
            -L) next=yes ;;
Packit 549fdc
            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
Packit 549fdc
                 dnl No need to hardcode the standard /usr/lib.
Packit 549fdc
                 if test "X$dir" != "X/usr/$acl_libdirstem" \
Packit 549fdc
                    && test "X$dir" != "X/usr/$acl_libdirstem2"; then
Packit 549fdc
                   rpathdirs="$rpathdirs $dir"
Packit 549fdc
                 fi
Packit 549fdc
                 next= ;;
Packit 549fdc
            *) next= ;;
Packit 549fdc
          esac
Packit 549fdc
        fi
Packit 549fdc
      done
Packit 549fdc
      if test "X$rpathdirs" != "X"; then
Packit 549fdc
        if test -n ""$3""; then
Packit 549fdc
          dnl libtool is used for linking. Use -R options.
Packit 549fdc
          for dir in $rpathdirs; do
Packit 549fdc
            $1="${$1}${$1:+ }-R$dir"
Packit 549fdc
          done
Packit 549fdc
        else
Packit 549fdc
          dnl The linker is used for linking directly.
Packit 549fdc
          if test -n "$acl_hardcode_libdir_separator"; then
Packit 549fdc
            dnl Weird platform: only the last -rpath option counts, the user
Packit 549fdc
            dnl must pass all path elements in one option.
Packit 549fdc
            alldirs=
Packit 549fdc
            for dir in $rpathdirs; do
Packit 549fdc
              alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
Packit 549fdc
            done
Packit 549fdc
            acl_save_libdir="$libdir"
Packit 549fdc
            libdir="$alldirs"
Packit 549fdc
            eval flag=\"$acl_hardcode_libdir_flag_spec\"
Packit 549fdc
            libdir="$acl_save_libdir"
Packit 549fdc
            $1="$flag"
Packit 549fdc
          else
Packit 549fdc
            dnl The -rpath options are cumulative.
Packit 549fdc
            for dir in $rpathdirs; do
Packit 549fdc
              acl_save_libdir="$libdir"
Packit 549fdc
              libdir="$dir"
Packit 549fdc
              eval flag=\"$acl_hardcode_libdir_flag_spec\"
Packit 549fdc
              libdir="$acl_save_libdir"
Packit 549fdc
              $1="${$1}${$1:+ }$flag"
Packit 549fdc
            done
Packit 549fdc
          fi
Packit 549fdc
        fi
Packit 549fdc
      fi
Packit 549fdc
    fi
Packit 549fdc
  fi
Packit 549fdc
  AC_SUBST([$1])
Packit 549fdc
])