Blame gnulib/m4/lib-link.m4

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