Revision 8d7dcace aclocal.m4

View differences:

aclocal.m4
7855 7855
fi[]dnl
7856 7856
])# PKG_CHECK_MODULES
7857 7857

  
7858
# iconv.m4 serial AM6 (gettext-0.17)
7859
dnl Copyright (C) 2000-2002, 2007 Free Software Foundation, Inc.
7860
dnl This file is free software; the Free Software Foundation
7861
dnl gives unlimited permission to copy and/or distribute it,
7862
dnl with or without modifications, as long as this notice is preserved.
7863

  
7864
dnl From Bruno Haible.
7865

  
7866
AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
7867
[
7868
  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
7869
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
7870
  AC_REQUIRE([AC_LIB_RPATH])
7871

  
7872
  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
7873
  dnl accordingly.
7874
  AC_LIB_LINKFLAGS_BODY([iconv])
7875
])
7876

  
7877
AC_DEFUN([AM_ICONV_LINK],
7878
[
7879
  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
7880
  dnl those with the standalone portable GNU libiconv installed).
7881
  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
7882

  
7883
  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
7884
  dnl accordingly.
7885
  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
7886

  
7887
  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
7888
  dnl because if the user has installed libiconv and not disabled its use
7889
  dnl via --without-libiconv-prefix, he wants to use it. The first
7890
  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
7891
  am_save_CPPFLAGS="$CPPFLAGS"
7892
  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
7893

  
7894
  AC_CACHE_CHECK([for iconv], am_cv_func_iconv, [
7895
    am_cv_func_iconv="no, consider installing GNU libiconv"
7896
    am_cv_lib_iconv=no
7897
    AC_TRY_LINK([#include <stdlib.h>
7898
#include <iconv.h>],
7899
      [iconv_t cd = iconv_open("","");
7900
       iconv(cd,NULL,NULL,NULL,NULL);
7901
       iconv_close(cd);],
7902
      am_cv_func_iconv=yes)
7903
    if test "$am_cv_func_iconv" != yes; then
7904
      am_save_LIBS="$LIBS"
7905
      LIBS="$LIBS $LIBICONV"
7906
      AC_TRY_LINK([#include <stdlib.h>
7907
#include <iconv.h>],
7908
        [iconv_t cd = iconv_open("","");
7909
         iconv(cd,NULL,NULL,NULL,NULL);
7910
         iconv_close(cd);],
7911
        am_cv_lib_iconv=yes
7912
        am_cv_func_iconv=yes)
7913
      LIBS="$am_save_LIBS"
7914
    fi
7915
  ])
7916
  if test "$am_cv_func_iconv" = yes; then
7917
    AC_CACHE_CHECK([for working iconv], am_cv_func_iconv_works, [
7918
      dnl This tests against bugs in AIX 5.1 and HP-UX 11.11.
7919
      am_save_LIBS="$LIBS"
7920
      if test $am_cv_lib_iconv = yes; then
7921
        LIBS="$LIBS $LIBICONV"
7922
      fi
7923
      AC_TRY_RUN([
7924
#include <iconv.h>
7925
#include <string.h>
7926
int main ()
7927
{
7928
  /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
7929
     returns.  */
7930
  {
7931
    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
7932
    if (cd_utf8_to_88591 != (iconv_t)(-1))
7933
      {
7934
        static const char input[] = "\342\202\254"; /* EURO SIGN */
7935
        char buf[10];
7936
        const char *inptr = input;
7937
        size_t inbytesleft = strlen (input);
7938
        char *outptr = buf;
7939
        size_t outbytesleft = sizeof (buf);
7940
        size_t res = iconv (cd_utf8_to_88591,
7941
                            (char **) &inptr, &inbytesleft,
7942
                            &outptr, &outbytesleft);
7943
        if (res == 0)
7944
          return 1;
7945
      }
7946
  }
7947
#if 0 /* This bug could be worked around by the caller.  */
7948
  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
7949
  {
7950
    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
7951
    if (cd_88591_to_utf8 != (iconv_t)(-1))
7952
      {
7953
        static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
7954
        char buf[50];
7955
        const char *inptr = input;
7956
        size_t inbytesleft = strlen (input);
7957
        char *outptr = buf;
7958
        size_t outbytesleft = sizeof (buf);
7959
        size_t res = iconv (cd_88591_to_utf8,
7960
                            (char **) &inptr, &inbytesleft,
7961
                            &outptr, &outbytesleft);
7962
        if ((int)res > 0)
7963
          return 1;
7964
      }
7965
  }
7966
#endif
7967
  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
7968
     provided.  */
7969
  if (/* Try standardized names.  */
7970
      iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
7971
      /* Try IRIX, OSF/1 names.  */
7972
      && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
7973
      /* Try AIX names.  */
7974
      && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
7975
      /* Try HP-UX names.  */
7976
      && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
7977
    return 1;
7978
  return 0;
7979
}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
7980
        [case "$host_os" in
7981
           aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
7982
           *)            am_cv_func_iconv_works="guessing yes" ;;
7983
         esac])
7984
      LIBS="$am_save_LIBS"
7985
    ])
7986
    case "$am_cv_func_iconv_works" in
7987
      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
7988
      *)   am_func_iconv=yes ;;
7989
    esac
7990
  else
7991
    am_func_iconv=no am_cv_lib_iconv=no
7992
  fi
7993
  if test "$am_func_iconv" = yes; then
7994
    AC_DEFINE(HAVE_ICONV, 1,
7995
      [Define if you have the iconv() function and it works.])
7996
  fi
7997
  if test "$am_cv_lib_iconv" = yes; then
7998
    AC_MSG_CHECKING([how to link with libiconv])
7999
    AC_MSG_RESULT([$LIBICONV])
8000
  else
8001
    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
8002
    dnl either.
8003
    CPPFLAGS="$am_save_CPPFLAGS"
8004
    LIBICONV=
8005
    LTLIBICONV=
8006
  fi
8007
  AC_SUBST(LIBICONV)
8008
  AC_SUBST(LTLIBICONV)
8009
])
8010

  
8011
AC_DEFUN([AM_ICONV],
8012
[
8013
  AM_ICONV_LINK
8014
  if test "$am_cv_func_iconv" = yes; then
8015
    AC_MSG_CHECKING([for iconv declaration])
8016
    AC_CACHE_VAL(am_cv_proto_iconv, [
8017
      AC_TRY_COMPILE([
8018
#include <stdlib.h>
8019
#include <iconv.h>
8020
extern
8021
#ifdef __cplusplus
8022
"C"
8023
#endif
8024
#if defined(__STDC__) || defined(__cplusplus)
8025
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
8026
#else
8027
size_t iconv();
8028
#endif
8029
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
8030
      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
8031
    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
8032
    AC_MSG_RESULT([$]{ac_t:-
8033
         }[$]am_cv_proto_iconv)
8034
    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
8035
      [Define as const if the declaration of iconv() needs const.])
8036
  fi
8037
])
8038

  
8039
# lib-prefix.m4 serial 5 (gettext-0.15)
8040
dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
8041
dnl This file is free software; the Free Software Foundation
8042
dnl gives unlimited permission to copy and/or distribute it,
8043
dnl with or without modifications, as long as this notice is preserved.
8044

  
8045
dnl From Bruno Haible.
8046

  
8047
dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
8048
dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
8049
dnl require excessive bracketing.
8050
ifdef([AC_HELP_STRING],
8051
[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
8052
[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
8053

  
8054
dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
8055
dnl to access previously installed libraries. The basic assumption is that
8056
dnl a user will want packages to use other packages he previously installed
8057
dnl with the same --prefix option.
8058
dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
8059
dnl libraries, but is otherwise very convenient.
8060
AC_DEFUN([AC_LIB_PREFIX],
8061
[
8062
  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
8063
  AC_REQUIRE([AC_PROG_CC])
8064
  AC_REQUIRE([AC_CANONICAL_HOST])
8065
  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
8066
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
8067
  dnl By default, look in $includedir and $libdir.
8068
  use_additional=yes
8069
  AC_LIB_WITH_FINAL_PREFIX([
8070
    eval additional_includedir=\"$includedir\"
8071
    eval additional_libdir=\"$libdir\"
8072
  ])
8073
  AC_LIB_ARG_WITH([lib-prefix],
8074
[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
8075
  --without-lib-prefix    don't search for libraries in includedir and libdir],
8076
[
8077
    if test "X$withval" = "Xno"; then
8078
      use_additional=no
8079
    else
8080
      if test "X$withval" = "X"; then
8081
        AC_LIB_WITH_FINAL_PREFIX([
8082
          eval additional_includedir=\"$includedir\"
8083
          eval additional_libdir=\"$libdir\"
8084
        ])
8085
      else
8086
        additional_includedir="$withval/include"
8087
        additional_libdir="$withval/$acl_libdirstem"
8088
      fi
8089
    fi
8090
])
8091
  if test $use_additional = yes; then
8092
    dnl Potentially add $additional_includedir to $CPPFLAGS.
8093
    dnl But don't add it
8094
    dnl   1. if it's the standard /usr/include,
8095
    dnl   2. if it's already present in $CPPFLAGS,
8096
    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
8097
    dnl   4. if it doesn't exist as a directory.
8098
    if test "X$additional_includedir" != "X/usr/include"; then
8099
      haveit=
8100
      for x in $CPPFLAGS; do
8101
        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
8102
        if test "X$x" = "X-I$additional_includedir"; then
8103
          haveit=yes
8104
          break
8105
        fi
8106
      done
8107
      if test -z "$haveit"; then
8108
        if test "X$additional_includedir" = "X/usr/local/include"; then
8109
          if test -n "$GCC"; then
8110
            case $host_os in
8111
              linux* | gnu* | k*bsd*-gnu) haveit=yes;;
8112
            esac
8113
          fi
8114
        fi
8115
        if test -z "$haveit"; then
8116
          if test -d "$additional_includedir"; then
8117
            dnl Really add $additional_includedir to $CPPFLAGS.
8118
            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
8119
          fi
8120
        fi
8121
      fi
8122
    fi
8123
    dnl Potentially add $additional_libdir to $LDFLAGS.
8124
    dnl But don't add it
8125
    dnl   1. if it's the standard /usr/lib,
8126
    dnl   2. if it's already present in $LDFLAGS,
8127
    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
8128
    dnl   4. if it doesn't exist as a directory.
8129
    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
8130
      haveit=
8131
      for x in $LDFLAGS; do
8132
        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
8133
        if test "X$x" = "X-L$additional_libdir"; then
8134
          haveit=yes
8135
          break
8136
        fi
8137
      done
8138
      if test -z "$haveit"; then
8139
        if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
8140
          if test -n "$GCC"; then
8141
            case $host_os in
8142
              linux*) haveit=yes;;
8143
            esac
8144
          fi
8145
        fi
8146
        if test -z "$haveit"; then
8147
          if test -d "$additional_libdir"; then
8148
            dnl Really add $additional_libdir to $LDFLAGS.
8149
            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
8150
          fi
8151
        fi
8152
      fi
8153
    fi
8154
  fi
8155
])
8156

  
8157
dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
8158
dnl acl_final_exec_prefix, containing the values to which $prefix and
8159
dnl $exec_prefix will expand at the end of the configure script.
8160
AC_DEFUN([AC_LIB_PREPARE_PREFIX],
8161
[
8162
  dnl Unfortunately, prefix and exec_prefix get only finally determined
8163
  dnl at the end of configure.
8164
  if test "X$prefix" = "XNONE"; then
8165
    acl_final_prefix="$ac_default_prefix"
8166
  else
8167
    acl_final_prefix="$prefix"
8168
  fi
8169
  if test "X$exec_prefix" = "XNONE"; then
8170
    acl_final_exec_prefix='${prefix}'
8171
  else
8172
    acl_final_exec_prefix="$exec_prefix"
8173
  fi
8174
  acl_save_prefix="$prefix"
8175
  prefix="$acl_final_prefix"
8176
  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
8177
  prefix="$acl_save_prefix"
8178
])
8179

  
8180
dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
8181
dnl variables prefix and exec_prefix bound to the values they will have
8182
dnl at the end of the configure script.
8183
AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
8184
[
8185
  acl_save_prefix="$prefix"
8186
  prefix="$acl_final_prefix"
8187
  acl_save_exec_prefix="$exec_prefix"
8188
  exec_prefix="$acl_final_exec_prefix"
8189
  $1
8190
  exec_prefix="$acl_save_exec_prefix"
8191
  prefix="$acl_save_prefix"
8192
])
8193

  
8194
dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
8195
dnl the basename of the libdir, either "lib" or "lib64".
8196
AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
8197
[
8198
  dnl There is no formal standard regarding lib and lib64. The current
8199
  dnl practice is that on a system supporting 32-bit and 64-bit instruction
8200
  dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
8201
  dnl libraries go under $prefix/lib. We determine the compiler's default
8202
  dnl mode by looking at the compiler's library search path. If at least
8203
  dnl of its elements ends in /lib64 or points to a directory whose absolute
8204
  dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
8205
  dnl default, namely "lib".
8206
  acl_libdirstem=lib
8207
  searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
8208
  if test -n "$searchpath"; then
8209
    acl_save_IFS="${IFS= 	}"; IFS=":"
8210
    for searchdir in $searchpath; do
8211
      if test -d "$searchdir"; then
8212
        case "$searchdir" in
8213
          */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
8214
          *) searchdir=`cd "$searchdir" && pwd`
8215
             case "$searchdir" in
8216
               */lib64 ) acl_libdirstem=lib64 ;;
8217
             esac ;;
8218
        esac
8219
      fi
8220
    done
8221
    IFS="$acl_save_IFS"
8222
  fi
8223
])
8224

  
8225
# lib-link.m4 serial 13 (gettext-0.17)
8226
dnl Copyright (C) 2001-2007 Free Software Foundation, Inc.
8227
dnl This file is free software; the Free Software Foundation
8228
dnl gives unlimited permission to copy and/or distribute it,
8229
dnl with or without modifications, as long as this notice is preserved.
8230

  
8231
dnl From Bruno Haible.
8232

  
8233
AC_PREREQ(2.54)
8234

  
8235
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
8236
dnl the libraries corresponding to explicit and implicit dependencies.
8237
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
8238
dnl augments the CPPFLAGS variable.
8239
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
8240
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
8241
AC_DEFUN([AC_LIB_LINKFLAGS],
8242
[
8243
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
8244
  AC_REQUIRE([AC_LIB_RPATH])
8245
  define([Name],[translit([$1],[./-], [___])])
8246
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
8247
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
8248
  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
8249
    AC_LIB_LINKFLAGS_BODY([$1], [$2])
8250
    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
8251
    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
8252
    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
8253
    ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
8254
  ])
8255
  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
8256
  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
8257
  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
8258
  LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
8259
  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
8260
  AC_SUBST([LIB]NAME)
8261
  AC_SUBST([LTLIB]NAME)
8262
  AC_SUBST([LIB]NAME[_PREFIX])
8263
  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
8264
  dnl results of this search when this library appears as a dependency.
8265
  HAVE_LIB[]NAME=yes
8266
  undefine([Name])
8267
  undefine([NAME])
8268
])
8269

  
8270
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
8271
dnl searches for libname and the libraries corresponding to explicit and
8272
dnl implicit dependencies, together with the specified include files and
8273
dnl the ability to compile and link the specified testcode. If found, it
8274
dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
8275
dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
8276
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
8277
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
8278
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
8279
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
8280
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
8281
[
8282
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
8283
  AC_REQUIRE([AC_LIB_RPATH])
8284
  define([Name],[translit([$1],[./-], [___])])
8285
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
8286
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
8287

  
8288
  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
8289
  dnl accordingly.
8290
  AC_LIB_LINKFLAGS_BODY([$1], [$2])
8291

  
8292
  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
8293
  dnl because if the user has installed lib[]Name and not disabled its use
8294
  dnl via --without-lib[]Name-prefix, he wants to use it.
8295
  ac_save_CPPFLAGS="$CPPFLAGS"
8296
  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
8297

  
8298
  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
8299
    ac_save_LIBS="$LIBS"
8300
    LIBS="$LIBS $LIB[]NAME"
8301
    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
8302
    LIBS="$ac_save_LIBS"
8303
  ])
8304
  if test "$ac_cv_lib[]Name" = yes; then
8305
    HAVE_LIB[]NAME=yes
8306
    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
8307
    AC_MSG_CHECKING([how to link with lib[]$1])
8308
    AC_MSG_RESULT([$LIB[]NAME])
8309
  else
8310
    HAVE_LIB[]NAME=no
8311
    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
8312
    dnl $INC[]NAME either.
8313
    CPPFLAGS="$ac_save_CPPFLAGS"
8314
    LIB[]NAME=
8315
    LTLIB[]NAME=
8316
    LIB[]NAME[]_PREFIX=
8317
  fi
8318
  AC_SUBST([HAVE_LIB]NAME)
8319
  AC_SUBST([LIB]NAME)
8320
  AC_SUBST([LTLIB]NAME)
8321
  AC_SUBST([LIB]NAME[_PREFIX])
8322
  undefine([Name])
8323
  undefine([NAME])
8324
])
8325

  
8326
dnl Determine the platform dependent parameters needed to use rpath:
8327
dnl   acl_libext,
8328
dnl   acl_shlibext,
8329
dnl   acl_hardcode_libdir_flag_spec,
8330
dnl   acl_hardcode_libdir_separator,
8331
dnl   acl_hardcode_direct,
8332
dnl   acl_hardcode_minus_L.
8333
AC_DEFUN([AC_LIB_RPATH],
8334
[
8335
  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
8336
  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
8337
  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
8338
  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
8339
  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
8340
  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
8341
  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
8342
    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
8343
    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
8344
    . ./conftest.sh
8345
    rm -f ./conftest.sh
8346
    acl_cv_rpath=done
8347
  ])
8348
  wl="$acl_cv_wl"
8349
  acl_libext="$acl_cv_libext"
8350
  acl_shlibext="$acl_cv_shlibext"
8351
  acl_libname_spec="$acl_cv_libname_spec"
8352
  acl_library_names_spec="$acl_cv_library_names_spec"
8353
  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
8354
  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
8355
  acl_hardcode_direct="$acl_cv_hardcode_direct"
8356
  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
8357
  dnl Determine whether the user wants rpath handling at all.
8358
  AC_ARG_ENABLE(rpath,
8359
    [  --disable-rpath         do not hardcode runtime library paths],
8360
    :, enable_rpath=yes)
8361
])
8362

  
8363
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
8364
dnl the libraries corresponding to explicit and implicit dependencies.
8365
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
8366
dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
8367
dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
8368
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
8369
[
8370
  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
8371
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
8372
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
8373
  dnl Autoconf >= 2.61 supports dots in --with options.
8374
  define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])])
8375
  dnl By default, look in $includedir and $libdir.
8376
  use_additional=yes
8377
  AC_LIB_WITH_FINAL_PREFIX([
8378
    eval additional_includedir=\"$includedir\"
8379
    eval additional_libdir=\"$libdir\"
8380
  ])
8381
  AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix],
8382
[  --with-lib]N_A_M_E[-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
8383
  --without-lib]N_A_M_E[-prefix     don't search for lib$1 in includedir and libdir],
8384
[
8385
    if test "X$withval" = "Xno"; then
8386
      use_additional=no
8387
    else
8388
      if test "X$withval" = "X"; then
8389
        AC_LIB_WITH_FINAL_PREFIX([
8390
          eval additional_includedir=\"$includedir\"
8391
          eval additional_libdir=\"$libdir\"
8392
        ])
8393
      else
8394
        additional_includedir="$withval/include"
8395
        additional_libdir="$withval/$acl_libdirstem"
8396
      fi
8397
    fi
8398
])
8399
  dnl Search the library and its dependencies in $additional_libdir and
8400
  dnl $LDFLAGS. Using breadth-first-seach.
8401
  LIB[]NAME=
8402
  LTLIB[]NAME=
8403
  INC[]NAME=
8404
  LIB[]NAME[]_PREFIX=
8405
  rpathdirs=
8406
  ltrpathdirs=
8407
  names_already_handled=
8408
  names_next_round='$1 $2'
8409
  while test -n "$names_next_round"; do
8410
    names_this_round="$names_next_round"
8411
    names_next_round=
8412
    for name in $names_this_round; do
8413
      already_handled=
8414
      for n in $names_already_handled; do
8415
        if test "$n" = "$name"; then
8416
          already_handled=yes
8417
          break
8418
        fi
8419
      done
8420
      if test -z "$already_handled"; then
8421
        names_already_handled="$names_already_handled $name"
8422
        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
8423
        dnl or AC_LIB_HAVE_LINKFLAGS call.
8424
        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
8425
        eval value=\"\$HAVE_LIB$uppername\"
8426
        if test -n "$value"; then
8427
          if test "$value" = yes; then
8428
            eval value=\"\$LIB$uppername\"
8429
            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
8430
            eval value=\"\$LTLIB$uppername\"
8431
            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
8432
          else
8433
            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
8434
            dnl that this library doesn't exist. So just drop it.
8435
            :
8436
          fi
8437
        else
8438
          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
8439
          dnl and the already constructed $LIBNAME/$LTLIBNAME.
8440
          found_dir=
8441
          found_la=
8442
          found_so=
8443
          found_a=
8444
          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
8445
          if test -n "$acl_shlibext"; then
8446
            shrext=".$acl_shlibext"             # typically: shrext=.so
8447
          else
8448
            shrext=
8449
          fi
8450
          if test $use_additional = yes; then
8451
            dir="$additional_libdir"
8452
            dnl The same code as in the loop below:
8453
            dnl First look for a shared library.
8454
            if test -n "$acl_shlibext"; then
8455
              if test -f "$dir/$libname$shrext"; then
8456
                found_dir="$dir"
8457
                found_so="$dir/$libname$shrext"
8458
              else
8459
                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
8460
                  ver=`(cd "$dir" && \
8461
                        for f in "$libname$shrext".*; do echo "$f"; done \
8462
                        | sed -e "s,^$libname$shrext\\\\.,," \
8463
                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
8464
                        | sed 1q ) 2>/dev/null`
8465
                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
8466
                    found_dir="$dir"
8467
                    found_so="$dir/$libname$shrext.$ver"
8468
                  fi
8469
                else
8470
                  eval library_names=\"$acl_library_names_spec\"
8471
                  for f in $library_names; do
8472
                    if test -f "$dir/$f"; then
8473
                      found_dir="$dir"
8474
                      found_so="$dir/$f"
8475
                      break
8476
                    fi
8477
                  done
8478
                fi
8479
              fi
8480
            fi
8481
            dnl Then look for a static library.
8482
            if test "X$found_dir" = "X"; then
8483
              if test -f "$dir/$libname.$acl_libext"; then
8484
                found_dir="$dir"
8485
                found_a="$dir/$libname.$acl_libext"
8486
              fi
8487
            fi
8488
            if test "X$found_dir" != "X"; then
8489
              if test -f "$dir/$libname.la"; then
8490
                found_la="$dir/$libname.la"
8491
              fi
8492
            fi
8493
          fi
8494
          if test "X$found_dir" = "X"; then
8495
            for x in $LDFLAGS $LTLIB[]NAME; do
8496
              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
8497
              case "$x" in
8498
                -L*)
8499
                  dir=`echo "X$x" | sed -e 's/^X-L//'`
8500
                  dnl First look for a shared library.
8501
                  if test -n "$acl_shlibext"; then
8502
                    if test -f "$dir/$libname$shrext"; then
8503
                      found_dir="$dir"
8504
                      found_so="$dir/$libname$shrext"
8505
                    else
8506
                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
8507
                        ver=`(cd "$dir" && \
8508
                              for f in "$libname$shrext".*; do echo "$f"; done \
8509
                              | sed -e "s,^$libname$shrext\\\\.,," \
8510
                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
8511
                              | sed 1q ) 2>/dev/null`
8512
                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
8513
                          found_dir="$dir"
8514
                          found_so="$dir/$libname$shrext.$ver"
8515
                        fi
8516
                      else
8517
                        eval library_names=\"$acl_library_names_spec\"
8518
                        for f in $library_names; do
8519
                          if test -f "$dir/$f"; then
8520
                            found_dir="$dir"
8521
                            found_so="$dir/$f"
8522
                            break
8523
                          fi
8524
                        done
8525
                      fi
8526
                    fi
8527
                  fi
8528
                  dnl Then look for a static library.
8529
                  if test "X$found_dir" = "X"; then
8530
                    if test -f "$dir/$libname.$acl_libext"; then
8531
                      found_dir="$dir"
8532
                      found_a="$dir/$libname.$acl_libext"
8533
                    fi
8534
                  fi
8535
                  if test "X$found_dir" != "X"; then
8536
                    if test -f "$dir/$libname.la"; then
8537
                      found_la="$dir/$libname.la"
8538
                    fi
8539
                  fi
8540
                  ;;
8541
              esac
8542
              if test "X$found_dir" != "X"; then
8543
                break
8544
              fi
8545
            done
8546
          fi
8547
          if test "X$found_dir" != "X"; then
8548
            dnl Found the library.
8549
            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
8550
            if test "X$found_so" != "X"; then
8551
              dnl Linking with a shared library. We attempt to hardcode its
8552
              dnl directory into the executable's runpath, unless it's the
8553
              dnl standard /usr/lib.
8554
              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
8555
                dnl No hardcoding is needed.
8556
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
8557
              else
8558
                dnl Use an explicit option to hardcode DIR into the resulting
8559
                dnl binary.
8560
                dnl Potentially add DIR to ltrpathdirs.
8561
                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
8562
                haveit=
8563
                for x in $ltrpathdirs; do
8564
                  if test "X$x" = "X$found_dir"; then
8565
                    haveit=yes
8566
                    break
8567
                  fi
8568
                done
8569
                if test -z "$haveit"; then
8570
                  ltrpathdirs="$ltrpathdirs $found_dir"
8571
                fi
8572
                dnl The hardcoding into $LIBNAME is system dependent.
8573
                if test "$acl_hardcode_direct" = yes; then
8574
                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
8575
                  dnl resulting binary.
8576
                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
8577
                else
8578
                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
8579
                    dnl Use an explicit option to hardcode DIR into the resulting
8580
                    dnl binary.
8581
                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
8582
                    dnl Potentially add DIR to rpathdirs.
8583
                    dnl The rpathdirs will be appended to $LIBNAME at the end.
8584
                    haveit=
8585
                    for x in $rpathdirs; do
8586
                      if test "X$x" = "X$found_dir"; then
8587
                        haveit=yes
8588
                        break
8589
                      fi
8590
                    done
8591
                    if test -z "$haveit"; then
8592
                      rpathdirs="$rpathdirs $found_dir"
8593
                    fi
8594
                  else
8595
                    dnl Rely on "-L$found_dir".
8596
                    dnl But don't add it if it's already contained in the LDFLAGS
8597
                    dnl or the already constructed $LIBNAME
8598
                    haveit=
8599
                    for x in $LDFLAGS $LIB[]NAME; do
8600
                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
8601
                      if test "X$x" = "X-L$found_dir"; then
8602
                        haveit=yes
8603
                        break
8604
                      fi
8605
                    done
8606
                    if test -z "$haveit"; then
8607
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
8608
                    fi
8609
                    if test "$acl_hardcode_minus_L" != no; then
8610
                      dnl FIXME: Not sure whether we should use
8611
                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
8612
                      dnl here.
8613
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
8614
                    else
8615
                      dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
8616
                      dnl here, because this doesn't fit in flags passed to the
8617
                      dnl compiler. So give up. No hardcoding. This affects only
8618
                      dnl very old systems.
8619
                      dnl FIXME: Not sure whether we should use
8620
                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
8621
                      dnl here.
8622
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
8623
                    fi
8624
                  fi
8625
                fi
8626
              fi
8627
            else
8628
              if test "X$found_a" != "X"; then
8629
                dnl Linking with a static library.
8630
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
8631
              else
8632
                dnl We shouldn't come here, but anyway it's good to have a
8633
                dnl fallback.
8634
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
8635
              fi
8636
            fi
8637
            dnl Assume the include files are nearby.
8638
            additional_includedir=
8639
            case "$found_dir" in
8640
              */$acl_libdirstem | */$acl_libdirstem/)
8641
                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
8642
                LIB[]NAME[]_PREFIX="$basedir"
8643
                additional_includedir="$basedir/include"
8644
                ;;
8645
            esac
8646
            if test "X$additional_includedir" != "X"; then
8647
              dnl Potentially add $additional_includedir to $INCNAME.
8648
              dnl But don't add it
8649
              dnl   1. if it's the standard /usr/include,
8650
              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
8651
              dnl   3. if it's already present in $CPPFLAGS or the already
8652
              dnl      constructed $INCNAME,
8653
              dnl   4. if it doesn't exist as a directory.
8654
              if test "X$additional_includedir" != "X/usr/include"; then
8655
                haveit=
8656
                if test "X$additional_includedir" = "X/usr/local/include"; then
8657
                  if test -n "$GCC"; then
8658
                    case $host_os in
8659
                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
8660
                    esac
8661
                  fi
8662
                fi
8663
                if test -z "$haveit"; then
8664
                  for x in $CPPFLAGS $INC[]NAME; do
8665
                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
8666
                    if test "X$x" = "X-I$additional_includedir"; then
8667
                      haveit=yes
8668
                      break
8669
                    fi
8670
                  done
8671
                  if test -z "$haveit"; then
8672
                    if test -d "$additional_includedir"; then
8673
                      dnl Really add $additional_includedir to $INCNAME.
8674
                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
8675
                    fi
8676
                  fi
8677
                fi
8678
              fi
8679
            fi
8680
            dnl Look for dependencies.
8681
            if test -n "$found_la"; then
8682
              dnl Read the .la file. It defines the variables
8683
              dnl dlname, library_names, old_library, dependency_libs, current,
8684
              dnl age, revision, installed, dlopen, dlpreopen, libdir.
8685
              save_libdir="$libdir"
8686
              case "$found_la" in
8687
                */* | *\\*) . "$found_la" ;;
8688
                *) . "./$found_la" ;;
8689
              esac
8690
              libdir="$save_libdir"
8691
              dnl We use only dependency_libs.
8692
              for dep in $dependency_libs; do
8693
                case "$dep" in
8694
                  -L*)
8695
                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
8696
                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
8697
                    dnl But don't add it
8698
                    dnl   1. if it's the standard /usr/lib,
8699
                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
8700
                    dnl   3. if it's already present in $LDFLAGS or the already
8701
                    dnl      constructed $LIBNAME,
8702
                    dnl   4. if it doesn't exist as a directory.
8703
                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
8704
                      haveit=
8705
                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
8706
                        if test -n "$GCC"; then
8707
                          case $host_os in
8708
                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
8709
                          esac
8710
                        fi
8711
                      fi
8712
                      if test -z "$haveit"; then
8713
                        haveit=
8714
                        for x in $LDFLAGS $LIB[]NAME; do
8715
                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
8716
                          if test "X$x" = "X-L$additional_libdir"; then
8717
                            haveit=yes
8718
                            break
8719
                          fi
8720
                        done
8721
                        if test -z "$haveit"; then
8722
                          if test -d "$additional_libdir"; then
8723
                            dnl Really add $additional_libdir to $LIBNAME.
8724
                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
8725
                          fi
8726
                        fi
8727
                        haveit=
8728
                        for x in $LDFLAGS $LTLIB[]NAME; do
8729
                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
8730
                          if test "X$x" = "X-L$additional_libdir"; then
8731
                            haveit=yes
8732
                            break
8733
                          fi
8734
                        done
8735
                        if test -z "$haveit"; then
8736
                          if test -d "$additional_libdir"; then
8737
                            dnl Really add $additional_libdir to $LTLIBNAME.
8738
                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
8739
                          fi
8740
                        fi
8741
                      fi
8742
                    fi
8743
                    ;;
8744
                  -R*)
8745
                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
8746
                    if test "$enable_rpath" != no; then
8747
                      dnl Potentially add DIR to rpathdirs.
8748
                      dnl The rpathdirs will be appended to $LIBNAME at the end.
8749
                      haveit=
8750
                      for x in $rpathdirs; do
8751
                        if test "X$x" = "X$dir"; then
8752
                          haveit=yes
8753
                          break
8754
                        fi
8755
                      done
8756
                      if test -z "$haveit"; then
8757
                        rpathdirs="$rpathdirs $dir"
8758
                      fi
8759
                      dnl Potentially add DIR to ltrpathdirs.
8760
                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
8761
                      haveit=
8762
                      for x in $ltrpathdirs; do
8763
                        if test "X$x" = "X$dir"; then
8764
                          haveit=yes
8765
                          break
8766
                        fi
8767
                      done
8768
                      if test -z "$haveit"; then
8769
                        ltrpathdirs="$ltrpathdirs $dir"
8770
                      fi
8771
                    fi
8772
                    ;;
8773
                  -l*)
8774
                    dnl Handle this in the next round.
8775
                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
8776
                    ;;
8777
                  *.la)
8778
                    dnl Handle this in the next round. Throw away the .la's
8779
                    dnl directory; it is already contained in a preceding -L
8780
                    dnl option.
8781
                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
8782
                    ;;
8783
                  *)
8784
                    dnl Most likely an immediate library name.
8785
                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
8786
                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
8787
                    ;;
8788
                esac
8789
              done
8790
            fi
8791
          else
8792
            dnl Didn't find the library; assume it is in the system directories
8793
            dnl known to the linker and runtime loader. (All the system
8794
            dnl directories known to the linker should also be known to the
8795
            dnl runtime loader, otherwise the system is severely misconfigured.)
8796
            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
8797
            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
8798
          fi
8799
        fi
8800
      fi
8801
    done
8802
  done
8803
  if test "X$rpathdirs" != "X"; then
8804
    if test -n "$acl_hardcode_libdir_separator"; then
8805
      dnl Weird platform: only the last -rpath option counts, the user must
8806
      dnl pass all path elements in one option. We can arrange that for a
8807
      dnl single library, but not when more than one $LIBNAMEs are used.
8808
      alldirs=
8809
      for found_dir in $rpathdirs; do
8810
        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
8811
      done
8812
      dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
8813
      acl_save_libdir="$libdir"
8814
      libdir="$alldirs"
8815
      eval flag=\"$acl_hardcode_libdir_flag_spec\"
8816
      libdir="$acl_save_libdir"
8817
      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
8818
    else
8819
      dnl The -rpath options are cumulative.
8820
      for found_dir in $rpathdirs; do
8821
        acl_save_libdir="$libdir"
8822
        libdir="$found_dir"
8823
        eval flag=\"$acl_hardcode_libdir_flag_spec\"
8824
        libdir="$acl_save_libdir"
8825
        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
8826
      done
8827
    fi
8828
  fi
8829
  if test "X$ltrpathdirs" != "X"; then
8830
    dnl When using libtool, the option that works for both libraries and
8831
    dnl executables is -R. The -R options are cumulative.
8832
    for found_dir in $ltrpathdirs; do
8833
      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
8834
    done
8835
  fi
8836
])
8837

  
8838
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
8839
dnl unless already present in VAR.
8840
dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
8841
dnl contains two or three consecutive elements that belong together.
8842
AC_DEFUN([AC_LIB_APPENDTOVAR],
8843
[
8844
  for element in [$2]; do
8845
    haveit=
8846
    for x in $[$1]; do
8847
      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
8848
      if test "X$x" = "X$element"; then
8849
        haveit=yes
8850
        break
8851
      fi
8852
    done
8853
    if test -z "$haveit"; then
8854
      [$1]="${[$1]}${[$1]:+ }$element"
8855
    fi
8856
  done
8857
])
8858

  
8859
dnl For those cases where a variable contains several -L and -l options
8860
dnl referring to unknown libraries and directories, this macro determines the
8861
dnl necessary additional linker options for the runtime path.
8862
dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
8863
dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
8864
dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
8865
dnl otherwise linking without libtool is assumed.
8866
AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
8867
[
8868
  AC_REQUIRE([AC_LIB_RPATH])
8869
  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
8870
  $1=
8871
  if test "$enable_rpath" != no; then
8872
    if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
8873
      dnl Use an explicit option to hardcode directories into the resulting
8874
      dnl binary.
8875
      rpathdirs=
8876
      next=
8877
      for opt in $2; do
8878
        if test -n "$next"; then
8879
          dir="$next"
8880
          dnl No need to hardcode the standard /usr/lib.
8881
          if test "X$dir" != "X/usr/$acl_libdirstem"; then
8882
            rpathdirs="$rpathdirs $dir"
8883
          fi
8884
          next=
8885
        else
8886
          case $opt in
8887
            -L) next=yes ;;
8888
            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
8889
                 dnl No need to hardcode the standard /usr/lib.
8890
                 if test "X$dir" != "X/usr/$acl_libdirstem"; then
8891
                   rpathdirs="$rpathdirs $dir"
8892
                 fi
8893
                 next= ;;
8894
            *) next= ;;
8895
          esac
8896
        fi
8897
      done
8898
      if test "X$rpathdirs" != "X"; then
8899
        if test -n ""$3""; then
8900
          dnl libtool is used for linking. Use -R options.
8901
          for dir in $rpathdirs; do
8902
            $1="${$1}${$1:+ }-R$dir"
8903
          done
8904
        else
8905
          dnl The linker is used for linking directly.
8906
          if test -n "$acl_hardcode_libdir_separator"; then
8907
            dnl Weird platform: only the last -rpath option counts, the user
8908
            dnl must pass all path elements in one option.
8909
            alldirs=
8910
            for dir in $rpathdirs; do
8911
              alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
8912
            done
8913
            acl_save_libdir="$libdir"
8914
            libdir="$alldirs"
8915
            eval flag=\"$acl_hardcode_libdir_flag_spec\"
8916
            libdir="$acl_save_libdir"
8917
            $1="$flag"
8918
          else
8919
            dnl The -rpath options are cumulative.
8920
            for dir in $rpathdirs; do
8921
              acl_save_libdir="$libdir"
8922
              libdir="$dir"
8923
              eval flag=\"$acl_hardcode_libdir_flag_spec\"
8924
              libdir="$acl_save_libdir"
8925
              $1="${$1}${$1:+ }$flag"
8926
            done
8927
          fi
8928
        fi
8929
      fi
8930
    fi
8931
  fi
8932
  AC_SUBST([$1])
8933
])
8934

  
8935
# lib-ld.m4 serial 3 (gettext-0.13)
8936
dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
8937
dnl This file is free software; the Free Software Foundation
8938
dnl gives unlimited permission to copy and/or distribute it,
8939
dnl with or without modifications, as long as this notice is preserved.
8940

  
8941
dnl Subroutines of libtool.m4,
8942
dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
8943
dnl with libtool.m4.
8944

  
8945
dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
8946
AC_DEFUN([AC_LIB_PROG_LD_GNU],
8947
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
8948
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
8949
case `$LD -v 2>&1 </dev/null` in
8950
*GNU* | *'with BFD'*)
8951
  acl_cv_prog_gnu_ld=yes ;;
8952
*)
8953
  acl_cv_prog_gnu_ld=no ;;
8954
esac])
8955
with_gnu_ld=$acl_cv_prog_gnu_ld
8956
])
8957

  
8958
dnl From libtool-1.4. Sets the variable LD.
8959
AC_DEFUN([AC_LIB_PROG_LD],
8960
[AC_ARG_WITH(gnu-ld,
8961
[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
8962
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
8963
AC_REQUIRE([AC_PROG_CC])dnl
8964
AC_REQUIRE([AC_CANONICAL_HOST])dnl
8965
# Prepare PATH_SEPARATOR.
8966
# The user is always right.
8967
if test "${PATH_SEPARATOR+set}" != set; then
8968
  echo "#! /bin/sh" >conf$$.sh
8969
  echo  "exit 0"   >>conf$$.sh
8970
  chmod +x conf$$.sh
8971
  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
8972
    PATH_SEPARATOR=';'
8973
  else
8974
    PATH_SEPARATOR=:
8975
  fi
8976
  rm -f conf$$.sh
8977
fi
8978
ac_prog=ld
8979
if test "$GCC" = yes; then
8980
  # Check if gcc -print-prog-name=ld gives a path.
8981
  AC_MSG_CHECKING([for ld used by GCC])
8982
  case $host in
8983
  *-*-mingw*)
8984
    # gcc leaves a trailing carriage return which upsets mingw
8985
    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
8986
  *)
8987
    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
8988
  esac
8989
  case $ac_prog in
8990
    # Accept absolute paths.
8991
    [[\\/]* | [A-Za-z]:[\\/]*)]
8992
      [re_direlt='/[^/][^/]*/\.\./']
8993
      # Canonicalize the path of ld
8994
      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
8995
      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
8996
	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
8997
      done
8998
      test -z "$LD" && LD="$ac_prog"
8999
      ;;
9000
  "")
9001
    # If it fails, then pretend we aren't using GCC.
9002
    ac_prog=ld
9003
    ;;
9004
  *)
9005
    # If it is relative, then search for the first ld in PATH.
9006
    with_gnu_ld=unknown
9007
    ;;
9008
  esac
9009
elif test "$with_gnu_ld" = yes; then
9010
  AC_MSG_CHECKING([for GNU ld])
9011
else
9012
  AC_MSG_CHECKING([for non-GNU ld])
9013
fi
9014
AC_CACHE_VAL(acl_cv_path_LD,
9015
[if test -z "$LD"; then
9016
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
9017
  for ac_dir in $PATH; do
9018
    test -z "$ac_dir" && ac_dir=.
9019
    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
9020
      acl_cv_path_LD="$ac_dir/$ac_prog"
9021
      # Check to see if the program is GNU ld.  I'd rather use --version,
9022
      # but apparently some GNU ld's only accept -v.
9023
      # Break only if it was the GNU/non-GNU ld that we prefer.
9024
      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
9025
      *GNU* | *'with BFD'*)
9026
	test "$with_gnu_ld" != no && break ;;
9027
      *)
9028
	test "$with_gnu_ld" != yes && break ;;
9029
      esac
9030
    fi
9031
  done
9032
  IFS="$ac_save_ifs"
9033
else
9034
  acl_cv_path_LD="$LD" # Let the user override the test with a path.
9035
fi])
9036
LD="$acl_cv_path_LD"
9037
if test -n "$LD"; then
9038
  AC_MSG_RESULT($LD)
9039
else
9040
  AC_MSG_RESULT(no)
9041
fi
9042
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
9043
AC_LIB_PROG_LD_GNU
9044
])
9045

  

Also available in: Unified diff