OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [config/] [lib-link.m4] - Diff between revs 157 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 157 Rev 816
# lib-link.m4 serial 4 (gettext-0.12)
# lib-link.m4 serial 4 (gettext-0.12)
dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License.  As a special exception to the GNU General
dnl General Public License.  As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl the same distribution terms as the rest of that program.
 
 
dnl From Bruno Haible.
dnl From Bruno Haible.
 
 
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
dnl the libraries corresponding to explicit and implicit dependencies.
dnl the libraries corresponding to explicit and implicit dependencies.
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
dnl augments the CPPFLAGS variable.
dnl augments the CPPFLAGS variable.
AC_DEFUN([AC_LIB_LINKFLAGS],
AC_DEFUN([AC_LIB_LINKFLAGS],
[
[
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
  AC_REQUIRE([AC_LIB_RPATH])
  AC_REQUIRE([AC_LIB_RPATH])
  define([Name],[translit([$1],[./-], [___])])
  define([Name],[translit([$1],[./-], [___])])
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
    AC_LIB_LINKFLAGS_BODY([$1], [$2])
    AC_LIB_LINKFLAGS_BODY([$1], [$2])
    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
  ])
  ])
  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
  AC_SUBST([LIB]NAME)
  AC_SUBST([LIB]NAME)
  AC_SUBST([LTLIB]NAME)
  AC_SUBST([LTLIB]NAME)
  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
  dnl results of this search when this library appears as a dependency.
  dnl results of this search when this library appears as a dependency.
  HAVE_LIB[]NAME=yes
  HAVE_LIB[]NAME=yes
  undefine([Name])
  undefine([Name])
  undefine([NAME])
  undefine([NAME])
])
])
 
 
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
dnl searches for libname and the libraries corresponding to explicit and
dnl searches for libname and the libraries corresponding to explicit and
dnl implicit dependencies, together with the specified include files and
dnl implicit dependencies, together with the specified include files and
dnl the ability to compile and link the specified testcode. If found, it
dnl the ability to compile and link the specified testcode. If found, it
dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
[
[
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
  AC_REQUIRE([AC_LIB_RPATH])
  AC_REQUIRE([AC_LIB_RPATH])
  define([Name],[translit([$1],[./-], [___])])
  define([Name],[translit([$1],[./-], [___])])
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
 
 
  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
  dnl accordingly.
  dnl accordingly.
  AC_LIB_LINKFLAGS_BODY([$1], [$2])
  AC_LIB_LINKFLAGS_BODY([$1], [$2])
 
 
  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
  dnl because if the user has installed lib[]Name and not disabled its use
  dnl because if the user has installed lib[]Name and not disabled its use
  dnl via --without-lib[]Name-prefix, he wants to use it.
  dnl via --without-lib[]Name-prefix, he wants to use it.
  ac_save_CPPFLAGS="$CPPFLAGS"
  ac_save_CPPFLAGS="$CPPFLAGS"
  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
 
 
  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
    ac_save_LIBS="$LIBS"
    ac_save_LIBS="$LIBS"
    LIBS="$LIBS $LIB[]NAME"
    LIBS="$LIBS $LIB[]NAME"
    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
    LIBS="$ac_save_LIBS"
    LIBS="$ac_save_LIBS"
  ])
  ])
  if test "$ac_cv_lib[]Name" = yes; then
  if test "$ac_cv_lib[]Name" = yes; then
    HAVE_LIB[]NAME=yes
    HAVE_LIB[]NAME=yes
    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
    AC_MSG_CHECKING([how to link with lib[]$1])
    AC_MSG_CHECKING([how to link with lib[]$1])
    AC_MSG_RESULT([$LIB[]NAME])
    AC_MSG_RESULT([$LIB[]NAME])
  else
  else
    HAVE_LIB[]NAME=no
    HAVE_LIB[]NAME=no
    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
    dnl $INC[]NAME either.
    dnl $INC[]NAME either.
    CPPFLAGS="$ac_save_CPPFLAGS"
    CPPFLAGS="$ac_save_CPPFLAGS"
    LIB[]NAME=
    LIB[]NAME=
    LTLIB[]NAME=
    LTLIB[]NAME=
  fi
  fi
  AC_SUBST([HAVE_LIB]NAME)
  AC_SUBST([HAVE_LIB]NAME)
  AC_SUBST([LIB]NAME)
  AC_SUBST([LIB]NAME)
  AC_SUBST([LTLIB]NAME)
  AC_SUBST([LTLIB]NAME)
  undefine([Name])
  undefine([Name])
  undefine([NAME])
  undefine([NAME])
])
])
 
 
dnl Determine the platform dependent parameters needed to use rpath:
dnl Determine the platform dependent parameters needed to use rpath:
dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
dnl hardcode_direct, hardcode_minus_L.
dnl hardcode_direct, hardcode_minus_L.
AC_DEFUN([AC_LIB_RPATH],
AC_DEFUN([AC_LIB_RPATH],
[
[
  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
    . ./conftest.sh
    . ./conftest.sh
    rm -f ./conftest.sh
    rm -f ./conftest.sh
    acl_cv_rpath=done
    acl_cv_rpath=done
  ])
  ])
  wl="$acl_cv_wl"
  wl="$acl_cv_wl"
  libext="$acl_cv_libext"
  libext="$acl_cv_libext"
  shlibext="$acl_cv_shlibext"
  shlibext="$acl_cv_shlibext"
  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
  hardcode_direct="$acl_cv_hardcode_direct"
  hardcode_direct="$acl_cv_hardcode_direct"
  hardcode_minus_L="$acl_cv_hardcode_minus_L"
  hardcode_minus_L="$acl_cv_hardcode_minus_L"
  dnl Determine whether the user wants rpath handling at all.
  dnl Determine whether the user wants rpath handling at all.
  AC_ARG_ENABLE(rpath,
  AC_ARG_ENABLE(rpath,
    [  --disable-rpath         do not hardcode runtime library paths],
    [  --disable-rpath         do not hardcode runtime library paths],
    :, enable_rpath=yes)
    :, enable_rpath=yes)
])
])
 
 
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
dnl the libraries corresponding to explicit and implicit dependencies.
dnl the libraries corresponding to explicit and implicit dependencies.
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
[
[
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
  dnl By default, look in $includedir and $libdir.
  dnl By default, look in $includedir and $libdir.
  use_additional=yes
  use_additional=yes
  AC_LIB_WITH_FINAL_PREFIX([
  AC_LIB_WITH_FINAL_PREFIX([
    eval additional_includedir=\"$includedir\"
    eval additional_includedir=\"$includedir\"
    eval additional_libdir=\"$libdir\"
    eval additional_libdir=\"$libdir\"
  ])
  ])
  AC_LIB_ARG_WITH([lib$1-prefix],
  AC_LIB_ARG_WITH([lib$1-prefix],
[  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
[  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
  --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
  --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
[
[
    if test "X$withval" = "Xno"; then
    if test "X$withval" = "Xno"; then
      use_additional=no
      use_additional=no
    else
    else
      if test "X$withval" = "X"; then
      if test "X$withval" = "X"; then
        AC_LIB_WITH_FINAL_PREFIX([
        AC_LIB_WITH_FINAL_PREFIX([
          eval additional_includedir=\"$includedir\"
          eval additional_includedir=\"$includedir\"
          eval additional_libdir=\"$libdir\"
          eval additional_libdir=\"$libdir\"
        ])
        ])
      else
      else
        additional_includedir="$withval/include"
        additional_includedir="$withval/include"
        additional_libdir="$withval/lib"
        additional_libdir="$withval/lib"
      fi
      fi
    fi
    fi
])
])
  dnl Search the library and its dependencies in $additional_libdir and
  dnl Search the library and its dependencies in $additional_libdir and
  dnl $LDFLAGS. Using breadth-first-seach.
  dnl $LDFLAGS. Using breadth-first-seach.
  LIB[]NAME=
  LIB[]NAME=
  LTLIB[]NAME=
  LTLIB[]NAME=
  INC[]NAME=
  INC[]NAME=
  rpathdirs=
  rpathdirs=
  ltrpathdirs=
  ltrpathdirs=
  names_already_handled=
  names_already_handled=
  names_next_round='$1 $2'
  names_next_round='$1 $2'
  while test -n "$names_next_round"; do
  while test -n "$names_next_round"; do
    names_this_round="$names_next_round"
    names_this_round="$names_next_round"
    names_next_round=
    names_next_round=
    for name in $names_this_round; do
    for name in $names_this_round; do
      already_handled=
      already_handled=
      for n in $names_already_handled; do
      for n in $names_already_handled; do
        if test "$n" = "$name"; then
        if test "$n" = "$name"; then
          already_handled=yes
          already_handled=yes
          break
          break
        fi
        fi
      done
      done
      if test -z "$already_handled"; then
      if test -z "$already_handled"; then
        names_already_handled="$names_already_handled $name"
        names_already_handled="$names_already_handled $name"
        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
        dnl or AC_LIB_HAVE_LINKFLAGS call.
        dnl or AC_LIB_HAVE_LINKFLAGS call.
        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
        eval value=\"\$HAVE_LIB$uppername\"
        eval value=\"\$HAVE_LIB$uppername\"
        if test -n "$value"; then
        if test -n "$value"; then
          if test "$value" = yes; then
          if test "$value" = yes; then
            eval value=\"\$LIB$uppername\"
            eval value=\"\$LIB$uppername\"
            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
            eval value=\"\$LTLIB$uppername\"
            eval value=\"\$LTLIB$uppername\"
            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
          else
          else
            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
            dnl that this library doesn't exist. So just drop it.
            dnl that this library doesn't exist. So just drop it.
            :
            :
          fi
          fi
        else
        else
          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
          dnl and the already constructed $LIBNAME/$LTLIBNAME.
          dnl and the already constructed $LIBNAME/$LTLIBNAME.
          found_dir=
          found_dir=
          found_la=
          found_la=
          found_so=
          found_so=
          found_a=
          found_a=
          if test $use_additional = yes; then
          if test $use_additional = yes; then
            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
              found_dir="$additional_libdir"
              found_dir="$additional_libdir"
              found_so="$additional_libdir/lib$name.$shlibext"
              found_so="$additional_libdir/lib$name.$shlibext"
              if test -f "$additional_libdir/lib$name.la"; then
              if test -f "$additional_libdir/lib$name.la"; then
                found_la="$additional_libdir/lib$name.la"
                found_la="$additional_libdir/lib$name.la"
              fi
              fi
            else
            else
              if test -f "$additional_libdir/lib$name.$libext"; then
              if test -f "$additional_libdir/lib$name.$libext"; then
                found_dir="$additional_libdir"
                found_dir="$additional_libdir"
                found_a="$additional_libdir/lib$name.$libext"
                found_a="$additional_libdir/lib$name.$libext"
                if test -f "$additional_libdir/lib$name.la"; then
                if test -f "$additional_libdir/lib$name.la"; then
                  found_la="$additional_libdir/lib$name.la"
                  found_la="$additional_libdir/lib$name.la"
                fi
                fi
              fi
              fi
            fi
            fi
          fi
          fi
          if test "X$found_dir" = "X"; then
          if test "X$found_dir" = "X"; then
            for x in $LDFLAGS $LTLIB[]NAME; do
            for x in $LDFLAGS $LTLIB[]NAME; do
              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
              case "$x" in
              case "$x" in
                -L*)
                -L*)
                  dir=`echo "X$x" | sed -e 's/^X-L//'`
                  dir=`echo "X$x" | sed -e 's/^X-L//'`
                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
                    found_dir="$dir"
                    found_dir="$dir"
                    found_so="$dir/lib$name.$shlibext"
                    found_so="$dir/lib$name.$shlibext"
                    if test -f "$dir/lib$name.la"; then
                    if test -f "$dir/lib$name.la"; then
                      found_la="$dir/lib$name.la"
                      found_la="$dir/lib$name.la"
                    fi
                    fi
                  else
                  else
                    if test -f "$dir/lib$name.$libext"; then
                    if test -f "$dir/lib$name.$libext"; then
                      found_dir="$dir"
                      found_dir="$dir"
                      found_a="$dir/lib$name.$libext"
                      found_a="$dir/lib$name.$libext"
                      if test -f "$dir/lib$name.la"; then
                      if test -f "$dir/lib$name.la"; then
                        found_la="$dir/lib$name.la"
                        found_la="$dir/lib$name.la"
                      fi
                      fi
                    fi
                    fi
                  fi
                  fi
                  ;;
                  ;;
              esac
              esac
              if test "X$found_dir" != "X"; then
              if test "X$found_dir" != "X"; then
                break
                break
              fi
              fi
            done
            done
          fi
          fi
          if test "X$found_dir" != "X"; then
          if test "X$found_dir" != "X"; then
            dnl Found the library.
            dnl Found the library.
            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
            if test "X$found_so" != "X"; then
            if test "X$found_so" != "X"; then
              dnl Linking with a shared library. We attempt to hardcode its
              dnl Linking with a shared library. We attempt to hardcode its
              dnl directory into the executable's runpath, unless it's the
              dnl directory into the executable's runpath, unless it's the
              dnl standard /usr/lib.
              dnl standard /usr/lib.
              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
                dnl No hardcoding is needed.
                dnl No hardcoding is needed.
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
              else
              else
                dnl Use an explicit option to hardcode DIR into the resulting
                dnl Use an explicit option to hardcode DIR into the resulting
                dnl binary.
                dnl binary.
                dnl Potentially add DIR to ltrpathdirs.
                dnl Potentially add DIR to ltrpathdirs.
                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
                haveit=
                haveit=
                for x in $ltrpathdirs; do
                for x in $ltrpathdirs; do
                  if test "X$x" = "X$found_dir"; then
                  if test "X$x" = "X$found_dir"; then
                    haveit=yes
                    haveit=yes
                    break
                    break
                  fi
                  fi
                done
                done
                if test -z "$haveit"; then
                if test -z "$haveit"; then
                  ltrpathdirs="$ltrpathdirs $found_dir"
                  ltrpathdirs="$ltrpathdirs $found_dir"
                fi
                fi
                dnl The hardcoding into $LIBNAME is system dependent.
                dnl The hardcoding into $LIBNAME is system dependent.
                if test "$hardcode_direct" = yes; then
                if test "$hardcode_direct" = yes; then
                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
                  dnl resulting binary.
                  dnl resulting binary.
                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
                else
                else
                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
                    dnl Use an explicit option to hardcode DIR into the resulting
                    dnl Use an explicit option to hardcode DIR into the resulting
                    dnl binary.
                    dnl binary.
                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
                    dnl Potentially add DIR to rpathdirs.
                    dnl Potentially add DIR to rpathdirs.
                    dnl The rpathdirs will be appended to $LIBNAME at the end.
                    dnl The rpathdirs will be appended to $LIBNAME at the end.
                    haveit=
                    haveit=
                    for x in $rpathdirs; do
                    for x in $rpathdirs; do
                      if test "X$x" = "X$found_dir"; then
                      if test "X$x" = "X$found_dir"; then
                        haveit=yes
                        haveit=yes
                        break
                        break
                      fi
                      fi
                    done
                    done
                    if test -z "$haveit"; then
                    if test -z "$haveit"; then
                      rpathdirs="$rpathdirs $found_dir"
                      rpathdirs="$rpathdirs $found_dir"
                    fi
                    fi
                  else
                  else
                    dnl Rely on "-L$found_dir".
                    dnl Rely on "-L$found_dir".
                    dnl But don't add it if it's already contained in the LDFLAGS
                    dnl But don't add it if it's already contained in the LDFLAGS
                    dnl or the already constructed $LIBNAME
                    dnl or the already constructed $LIBNAME
                    haveit=
                    haveit=
                    for x in $LDFLAGS $LIB[]NAME; do
                    for x in $LDFLAGS $LIB[]NAME; do
                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
                      if test "X$x" = "X-L$found_dir"; then
                      if test "X$x" = "X-L$found_dir"; then
                        haveit=yes
                        haveit=yes
                        break
                        break
                      fi
                      fi
                    done
                    done
                    if test -z "$haveit"; then
                    if test -z "$haveit"; then
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
                    fi
                    fi
                    if test "$hardcode_minus_L" != no; then
                    if test "$hardcode_minus_L" != no; then
                      dnl FIXME: Not sure whether we should use
                      dnl FIXME: Not sure whether we should use
                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
                      dnl here.
                      dnl here.
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
                    else
                    else
                      dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
                      dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
                      dnl here, because this doesn't fit in flags passed to the
                      dnl here, because this doesn't fit in flags passed to the
                      dnl compiler. So give up. No hardcoding. This affects only
                      dnl compiler. So give up. No hardcoding. This affects only
                      dnl very old systems.
                      dnl very old systems.
                      dnl FIXME: Not sure whether we should use
                      dnl FIXME: Not sure whether we should use
                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
                      dnl here.
                      dnl here.
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
                    fi
                    fi
                  fi
                  fi
                fi
                fi
              fi
              fi
            else
            else
              if test "X$found_a" != "X"; then
              if test "X$found_a" != "X"; then
                dnl Linking with a static library.
                dnl Linking with a static library.
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
              else
              else
                dnl We shouldn't come here, but anyway it's good to have a
                dnl We shouldn't come here, but anyway it's good to have a
                dnl fallback.
                dnl fallback.
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
              fi
              fi
            fi
            fi
            dnl Assume the include files are nearby.
            dnl Assume the include files are nearby.
            additional_includedir=
            additional_includedir=
            case "$found_dir" in
            case "$found_dir" in
              */lib | */lib/)
              */lib | */lib/)
                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
                additional_includedir="$basedir/include"
                additional_includedir="$basedir/include"
                ;;
                ;;
            esac
            esac
            if test "X$additional_includedir" != "X"; then
            if test "X$additional_includedir" != "X"; then
              dnl Potentially add $additional_includedir to $INCNAME.
              dnl Potentially add $additional_includedir to $INCNAME.
              dnl But don't add it
              dnl But don't add it
              dnl   1. if it's the standard /usr/include,
              dnl   1. if it's the standard /usr/include,
              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
              dnl   3. if it's already present in $CPPFLAGS or the already
              dnl   3. if it's already present in $CPPFLAGS or the already
              dnl      constructed $INCNAME,
              dnl      constructed $INCNAME,
              dnl   4. if it doesn't exist as a directory.
              dnl   4. if it doesn't exist as a directory.
              if test "X$additional_includedir" != "X/usr/include"; then
              if test "X$additional_includedir" != "X/usr/include"; then
                haveit=
                haveit=
                if test "X$additional_includedir" = "X/usr/local/include"; then
                if test "X$additional_includedir" = "X/usr/local/include"; then
                  if test -n "$GCC"; then
                  if test -n "$GCC"; then
                    case $host_os in
                    case $host_os in
                      linux*) haveit=yes;;
                      linux*) haveit=yes;;
                    esac
                    esac
                  fi
                  fi
                fi
                fi
                if test -z "$haveit"; then
                if test -z "$haveit"; then
                  for x in $CPPFLAGS $INC[]NAME; do
                  for x in $CPPFLAGS $INC[]NAME; do
                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
                    if test "X$x" = "X-I$additional_includedir"; then
                    if test "X$x" = "X-I$additional_includedir"; then
                      haveit=yes
                      haveit=yes
                      break
                      break
                    fi
                    fi
                  done
                  done
                  if test -z "$haveit"; then
                  if test -z "$haveit"; then
                    if test -d "$additional_includedir"; then
                    if test -d "$additional_includedir"; then
                      dnl Really add $additional_includedir to $INCNAME.
                      dnl Really add $additional_includedir to $INCNAME.
                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
                    fi
                    fi
                  fi
                  fi
                fi
                fi
              fi
              fi
            fi
            fi
            dnl Look for dependencies.
            dnl Look for dependencies.
            if test -n "$found_la"; then
            if test -n "$found_la"; then
              dnl Read the .la file. It defines the variables
              dnl Read the .la file. It defines the variables
              dnl dlname, library_names, old_library, dependency_libs, current,
              dnl dlname, library_names, old_library, dependency_libs, current,
              dnl age, revision, installed, dlopen, dlpreopen, libdir.
              dnl age, revision, installed, dlopen, dlpreopen, libdir.
              save_libdir="$libdir"
              save_libdir="$libdir"
              case "$found_la" in
              case "$found_la" in
                */* | *\\*) . "$found_la" ;;
                */* | *\\*) . "$found_la" ;;
                *) . "./$found_la" ;;
                *) . "./$found_la" ;;
              esac
              esac
              libdir="$save_libdir"
              libdir="$save_libdir"
              dnl We use only dependency_libs.
              dnl We use only dependency_libs.
              for dep in $dependency_libs; do
              for dep in $dependency_libs; do
                case "$dep" in
                case "$dep" in
                  -L*)
                  -L*)
                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
                    dnl But don't add it
                    dnl But don't add it
                    dnl   1. if it's the standard /usr/lib,
                    dnl   1. if it's the standard /usr/lib,
                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
                    dnl   3. if it's already present in $LDFLAGS or the already
                    dnl   3. if it's already present in $LDFLAGS or the already
                    dnl      constructed $LIBNAME,
                    dnl      constructed $LIBNAME,
                    dnl   4. if it doesn't exist as a directory.
                    dnl   4. if it doesn't exist as a directory.
                    if test "X$additional_libdir" != "X/usr/lib"; then
                    if test "X$additional_libdir" != "X/usr/lib"; then
                      haveit=
                      haveit=
                      if test "X$additional_libdir" = "X/usr/local/lib"; then
                      if test "X$additional_libdir" = "X/usr/local/lib"; then
                        if test -n "$GCC"; then
                        if test -n "$GCC"; then
                          case $host_os in
                          case $host_os in
                            linux*) haveit=yes;;
                            linux*) haveit=yes;;
                          esac
                          esac
                        fi
                        fi
                      fi
                      fi
                      if test -z "$haveit"; then
                      if test -z "$haveit"; then
                        haveit=
                        haveit=
                        for x in $LDFLAGS $LIB[]NAME; do
                        for x in $LDFLAGS $LIB[]NAME; do
                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
                          if test "X$x" = "X-L$additional_libdir"; then
                          if test "X$x" = "X-L$additional_libdir"; then
                            haveit=yes
                            haveit=yes
                            break
                            break
                          fi
                          fi
                        done
                        done
                        if test -z "$haveit"; then
                        if test -z "$haveit"; then
                          if test -d "$additional_libdir"; then
                          if test -d "$additional_libdir"; then
                            dnl Really add $additional_libdir to $LIBNAME.
                            dnl Really add $additional_libdir to $LIBNAME.
                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
                          fi
                          fi
                        fi
                        fi
                        haveit=
                        haveit=
                        for x in $LDFLAGS $LTLIB[]NAME; do
                        for x in $LDFLAGS $LTLIB[]NAME; do
                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
                          if test "X$x" = "X-L$additional_libdir"; then
                          if test "X$x" = "X-L$additional_libdir"; then
                            haveit=yes
                            haveit=yes
                            break
                            break
                          fi
                          fi
                        done
                        done
                        if test -z "$haveit"; then
                        if test -z "$haveit"; then
                          if test -d "$additional_libdir"; then
                          if test -d "$additional_libdir"; then
                            dnl Really add $additional_libdir to $LTLIBNAME.
                            dnl Really add $additional_libdir to $LTLIBNAME.
                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
                          fi
                          fi
                        fi
                        fi
                      fi
                      fi
                    fi
                    fi
                    ;;
                    ;;
                  -R*)
                  -R*)
                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
                    if test "$enable_rpath" != no; then
                    if test "$enable_rpath" != no; then
                      dnl Potentially add DIR to rpathdirs.
                      dnl Potentially add DIR to rpathdirs.
                      dnl The rpathdirs will be appended to $LIBNAME at the end.
                      dnl The rpathdirs will be appended to $LIBNAME at the end.
                      haveit=
                      haveit=
                      for x in $rpathdirs; do
                      for x in $rpathdirs; do
                        if test "X$x" = "X$dir"; then
                        if test "X$x" = "X$dir"; then
                          haveit=yes
                          haveit=yes
                          break
                          break
                        fi
                        fi
                      done
                      done
                      if test -z "$haveit"; then
                      if test -z "$haveit"; then
                        rpathdirs="$rpathdirs $dir"
                        rpathdirs="$rpathdirs $dir"
                      fi
                      fi
                      dnl Potentially add DIR to ltrpathdirs.
                      dnl Potentially add DIR to ltrpathdirs.
                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
                      haveit=
                      haveit=
                      for x in $ltrpathdirs; do
                      for x in $ltrpathdirs; do
                        if test "X$x" = "X$dir"; then
                        if test "X$x" = "X$dir"; then
                          haveit=yes
                          haveit=yes
                          break
                          break
                        fi
                        fi
                      done
                      done
                      if test -z "$haveit"; then
                      if test -z "$haveit"; then
                        ltrpathdirs="$ltrpathdirs $dir"
                        ltrpathdirs="$ltrpathdirs $dir"
                      fi
                      fi
                    fi
                    fi
                    ;;
                    ;;
                  -l*)
                  -l*)
                    dnl Handle this in the next round.
                    dnl Handle this in the next round.
                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
                    ;;
                    ;;
                  *.la)
                  *.la)
                    dnl Handle this in the next round. Throw away the .la's
                    dnl Handle this in the next round. Throw away the .la's
                    dnl directory; it is already contained in a preceding -L
                    dnl directory; it is already contained in a preceding -L
                    dnl option.
                    dnl option.
                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
                    ;;
                    ;;
                  *)
                  *)
                    dnl Most likely an immediate library name.
                    dnl Most likely an immediate library name.
                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
                    ;;
                    ;;
                esac
                esac
              done
              done
            fi
            fi
          else
          else
            dnl Didn't find the library; assume it is in the system directories
            dnl Didn't find the library; assume it is in the system directories
            dnl known to the linker and runtime loader. (All the system
            dnl known to the linker and runtime loader. (All the system
            dnl directories known to the linker should also be known to the
            dnl directories known to the linker should also be known to the
            dnl runtime loader, otherwise the system is severely misconfigured.)
            dnl runtime loader, otherwise the system is severely misconfigured.)
            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
          fi
          fi
        fi
        fi
      fi
      fi
    done
    done
  done
  done
  if test "X$rpathdirs" != "X"; then
  if test "X$rpathdirs" != "X"; then
    if test -n "$hardcode_libdir_separator"; then
    if test -n "$hardcode_libdir_separator"; then
      dnl Weird platform: only the last -rpath option counts, the user must
      dnl Weird platform: only the last -rpath option counts, the user must
      dnl pass all path elements in one option. We can arrange that for a
      dnl pass all path elements in one option. We can arrange that for a
      dnl single library, but not when more than one $LIBNAMEs are used.
      dnl single library, but not when more than one $LIBNAMEs are used.
      alldirs=
      alldirs=
      for found_dir in $rpathdirs; do
      for found_dir in $rpathdirs; do
        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
      done
      done
      dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
      dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
      acl_save_libdir="$libdir"
      acl_save_libdir="$libdir"
      libdir="$alldirs"
      libdir="$alldirs"
      eval flag=\"$hardcode_libdir_flag_spec\"
      eval flag=\"$hardcode_libdir_flag_spec\"
      libdir="$acl_save_libdir"
      libdir="$acl_save_libdir"
      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
    else
    else
      dnl The -rpath options are cumulative.
      dnl The -rpath options are cumulative.
      for found_dir in $rpathdirs; do
      for found_dir in $rpathdirs; do
        acl_save_libdir="$libdir"
        acl_save_libdir="$libdir"
        libdir="$found_dir"
        libdir="$found_dir"
        eval flag=\"$hardcode_libdir_flag_spec\"
        eval flag=\"$hardcode_libdir_flag_spec\"
        libdir="$acl_save_libdir"
        libdir="$acl_save_libdir"
        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
      done
      done
    fi
    fi
  fi
  fi
  if test "X$ltrpathdirs" != "X"; then
  if test "X$ltrpathdirs" != "X"; then
    dnl When using libtool, the option that works for both libraries and
    dnl When using libtool, the option that works for both libraries and
    dnl executables is -R. The -R options are cumulative.
    dnl executables is -R. The -R options are cumulative.
    for found_dir in $ltrpathdirs; do
    for found_dir in $ltrpathdirs; do
      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
    done
    done
  fi
  fi
])
])
 
 
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
dnl unless already present in VAR.
dnl unless already present in VAR.
dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
dnl contains two or three consecutive elements that belong together.
dnl contains two or three consecutive elements that belong together.
AC_DEFUN([AC_LIB_APPENDTOVAR],
AC_DEFUN([AC_LIB_APPENDTOVAR],
[
[
  for element in [$2]; do
  for element in [$2]; do
    haveit=
    haveit=
    for x in $[$1]; do
    for x in $[$1]; do
      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
      if test "X$x" = "X$element"; then
      if test "X$x" = "X$element"; then
        haveit=yes
        haveit=yes
        break
        break
      fi
      fi
    done
    done
    if test -z "$haveit"; then
    if test -z "$haveit"; then
      [$1]="${[$1]}${[$1]:+ }$element"
      [$1]="${[$1]}${[$1]:+ }$element"
    fi
    fi
  done
  done
])
])
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.