121308Sachednl aclocal.m4 generated automatically by aclocal 1.4-p6
221308Sache
3157184Sachednl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
421308Sachednl This file is free software; the Free Software Foundation
521308Sachednl gives unlimited permission to copy and/or distribute it,
621308Sachednl with or without modifications, as long as this notice is preserved.
721308Sache
821308Sachednl This program is distributed in the hope that it will be useful,
921308Sachednl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
1058310Sachednl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1121308Sachednl PARTICULAR PURPOSE.
1221308Sache
1321308Sache# lib-prefix.m4 serial 3 (gettext-0.13)
1421308Sachednl Copyright (C) 2001-2003 Free Software Foundation, Inc.
1521308Sachednl This file is free software, distributed under the terms of the GNU
1621308Sachednl General Public License.  As a special exception to the GNU General
1721308Sachednl Public License, this file may be distributed as part of a program
1821308Sachednl that contains a configuration script generated by Autoconf, under
1921308Sachednl the same distribution terms as the rest of that program.
2021308Sache
2158310Sachednl From Bruno Haible.
2221308Sache
2321308Sachednl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
2421308Sachednl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
2521308Sachednl require excessive bracketing.
2621308Sacheifdef([AC_HELP_STRING],
2721308Sache[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
2821308Sache[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
2921308Sache
3021308Sachednl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
3121308Sachednl to access previously installed libraries. The basic assumption is that
3221308Sachednl a user will want packages to use other packages he previously installed
3321308Sachednl with the same --prefix option.
3421308Sachednl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
3521308Sachednl libraries, but is otherwise very convenient.
3621308SacheAC_DEFUN([AC_LIB_PREFIX],
3721308Sache[
3821308Sache  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
3921308Sache  AC_REQUIRE([AC_PROG_CC])
4021308Sache  AC_REQUIRE([AC_CANONICAL_HOST])
4121308Sache  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
4221308Sache  dnl By default, look in $includedir and $libdir.
4321308Sache  use_additional=yes
4421308Sache  AC_LIB_WITH_FINAL_PREFIX([
4521308Sache    eval additional_includedir=\"$includedir\"
4621308Sache    eval additional_libdir=\"$libdir\"
4721308Sache  ])
4858310Sache  AC_LIB_ARG_WITH([lib-prefix],
4958310Sache[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
5021308Sache  --without-lib-prefix    don't search for libraries in includedir and libdir],
5121308Sache[
5221308Sache    if test "X$withval" = "Xno"; then
5321308Sache      use_additional=no
5421308Sache    else
5521308Sache      if test "X$withval" = "X"; then
5621308Sache        AC_LIB_WITH_FINAL_PREFIX([
5721308Sache          eval additional_includedir=\"$includedir\"
5821308Sache          eval additional_libdir=\"$libdir\"
5921308Sache        ])
6021308Sache      else
6121308Sache        additional_includedir="$withval/include"
6221308Sache        additional_libdir="$withval/lib"
6321308Sache      fi
6475406Sache    fi
6521308Sache])
6621308Sache  if test $use_additional = yes; then
6721308Sache    dnl Potentially add $additional_includedir to $CPPFLAGS.
6858310Sache    dnl But don't add it
6958310Sache    dnl   1. if it's the standard /usr/include,
7058310Sache    dnl   2. if it's already present in $CPPFLAGS,
7158310Sache    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
7258310Sache    dnl   4. if it doesn't exist as a directory.
7358310Sache    if test "X$additional_includedir" != "X/usr/include"; then
7458310Sache      haveit=
7547558Sache      for x in $CPPFLAGS; do
76136644Sache        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
77136644Sache        if test "X$x" = "X-I$additional_includedir"; then
78136644Sache          haveit=yes
79136644Sache          break
80119610Sache        fi
81119610Sache      done
8247558Sache      if test -z "$haveit"; then
8347558Sache        if test "X$additional_includedir" = "X/usr/local/include"; then
8447558Sache          if test -n "$GCC"; then
8547558Sache            case $host_os in
8647558Sache              linux*) haveit=yes;;
8747558Sache            esac
8847558Sache          fi
8947558Sache        fi
9047558Sache        if test -z "$haveit"; then
9147558Sache          if test -d "$additional_includedir"; then
92136644Sache            dnl Really add $additional_includedir to $CPPFLAGS.
93136644Sache            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
9447558Sache          fi
9547558Sache        fi
9647558Sache      fi
9747558Sache    fi
9847558Sache    dnl Potentially add $additional_libdir to $LDFLAGS.
9921308Sache    dnl But don't add it
10021308Sache    dnl   1. if it's the standard /usr/lib,
10121308Sache    dnl   2. if it's already present in $LDFLAGS,
10221308Sache    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
10321308Sache    dnl   4. if it doesn't exist as a directory.
10421308Sache    if test "X$additional_libdir" != "X/usr/lib"; then
10547558Sache      haveit=
10647558Sache      for x in $LDFLAGS; do
10726497Sache        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
10826497Sache        if test "X$x" = "X-L$additional_libdir"; then
10921308Sache          haveit=yes
11021308Sache          break
11121308Sache        fi
11221308Sache      done
11321308Sache      if test -z "$haveit"; then
11421308Sache        if test "X$additional_libdir" = "X/usr/local/lib"; then
11521308Sache          if test -n "$GCC"; then
11621308Sache            case $host_os in
11721308Sache              linux*) haveit=yes;;
11821308Sache            esac
11921308Sache          fi
12021308Sache        fi
12121308Sache        if test -z "$haveit"; then
12221308Sache          if test -d "$additional_libdir"; then
12321308Sache            dnl Really add $additional_libdir to $LDFLAGS.
12426497Sache            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
12526497Sache          fi
12626497Sache        fi
12721308Sache      fi
12821308Sache    fi
12975406Sache  fi
13075406Sache])
13121308Sache
13221308Sachednl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
13321308Sachednl acl_final_exec_prefix, containing the values to which $prefix and
134157184Sachednl $exec_prefix will expand at the end of the configure script.
13521308SacheAC_DEFUN([AC_LIB_PREPARE_PREFIX],
136157184Sache[
137157184Sache  dnl Unfortunately, prefix and exec_prefix get only finally determined
138157184Sache  dnl at the end of configure.
13926497Sache  if test "X$prefix" = "XNONE"; then
14021308Sache    acl_final_prefix="$ac_default_prefix"
14121308Sache  else
14221308Sache    acl_final_prefix="$prefix"
14321308Sache  fi
14421308Sache  if test "X$exec_prefix" = "XNONE"; then
14547558Sache    acl_final_exec_prefix='${prefix}'
14647558Sache  else
14721308Sache    acl_final_exec_prefix="$exec_prefix"
148157184Sache  fi
14921308Sache  acl_save_prefix="$prefix"
15021308Sache  prefix="$acl_final_prefix"
15121308Sache  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
15221308Sache  prefix="$acl_save_prefix"
15321308Sache])
154157184Sache
15521308Sachednl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
156157184Sachednl variables prefix and exec_prefix bound to the values they will have
157157184Sachednl at the end of the configure script.
15847558SacheAC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
159157184Sache[
16047558Sache  acl_save_prefix="$prefix"
16121308Sache  prefix="$acl_final_prefix"
16221308Sache  acl_save_exec_prefix="$exec_prefix"
163165670Sache  exec_prefix="$acl_final_exec_prefix"
16421308Sache  $1
16521308Sache  exec_prefix="$acl_save_exec_prefix"
16621308Sache  prefix="$acl_save_prefix"
16721308Sache])
16821308Sache
16921308Sache# lib-link.m4 serial 4 (gettext-0.12)
17021308Sachednl Copyright (C) 2001-2003 Free Software Foundation, Inc.
17121308Sachednl This file is free software, distributed under the terms of the GNU
17258310Sachednl General Public License.  As a special exception to the GNU General
17358310Sachednl Public License, this file may be distributed as part of a program
17458310Sachednl that contains a configuration script generated by Autoconf, under
17558310Sachednl the same distribution terms as the rest of that program.
176157184Sache
17721308Sachednl From Bruno Haible.
178157184Sache
179157184Sachednl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
180157184Sachednl the libraries corresponding to explicit and implicit dependencies.
18121308Sachednl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
18221308Sachednl augments the CPPFLAGS variable.
18321308SacheAC_DEFUN([AC_LIB_LINKFLAGS],
18421308Sache[
18521308Sache  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
18621308Sache  AC_REQUIRE([AC_LIB_RPATH])
18721308Sache  define([Name],[translit([$1],[./-], [___])])
18821308Sache  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
18921308Sache                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
19021308Sache  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
19147558Sache    AC_LIB_LINKFLAGS_BODY([$1], [$2])
19221308Sache    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
19321308Sache    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
19475406Sache    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
19521308Sache  ])
19621308Sache  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
19721308Sache  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
19821308Sache  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
19921308Sache  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
20047558Sache  AC_SUBST([LIB]NAME)
20121308Sache  AC_SUBST([LTLIB]NAME)
20221308Sache  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
20321308Sache  dnl results of this search when this library appears as a dependency.
20421308Sache  HAVE_LIB[]NAME=yes
20526497Sache  undefine([Name])
20626497Sache  undefine([NAME])
20726497Sache])
20826497Sache
20926497Sachednl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
21026497Sachednl searches for libname and the libraries corresponding to explicit and
21126497Sachednl implicit dependencies, together with the specified include files and
21247558Sachednl the ability to compile and link the specified testcode. If found, it
21326497Sachednl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
21426497Sachednl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
21575406Sachednl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
21647558Sachednl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
21721308SacheAC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
21821308Sache[
21921308Sache  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
22021308Sache  AC_REQUIRE([AC_LIB_RPATH])
22121308Sache  define([Name],[translit([$1],[./-], [___])])
22221308Sache  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
22375406Sache                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
22421308Sache
22521308Sache  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
22621308Sache  dnl accordingly.
22721308Sache  AC_LIB_LINKFLAGS_BODY([$1], [$2])
22821308Sache
22921308Sache  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
23021308Sache  dnl because if the user has installed lib[]Name and not disabled its use
23121308Sache  dnl via --without-lib[]Name-prefix, he wants to use it.
23221308Sache  ac_save_CPPFLAGS="$CPPFLAGS"
23321308Sache  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
23421308Sache
23521308Sache  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
23621308Sache    ac_save_LIBS="$LIBS"
23721308Sache    LIBS="$LIBS $LIB[]NAME"
23821308Sache    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
23921308Sache    LIBS="$ac_save_LIBS"
24021308Sache  ])
24121308Sache  if test "$ac_cv_lib[]Name" = yes; then
24221308Sache    HAVE_LIB[]NAME=yes
24321308Sache    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
24421308Sache    AC_MSG_CHECKING([how to link with lib[]$1])
24521308Sache    AC_MSG_RESULT([$LIB[]NAME])
24621308Sache  else
24721308Sache    HAVE_LIB[]NAME=no
24821308Sache    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
24921308Sache    dnl $INC[]NAME either.
25058310Sache    CPPFLAGS="$ac_save_CPPFLAGS"
25121308Sache    LIB[]NAME=
25221308Sache    LTLIB[]NAME=
25321308Sache  fi
25421308Sache  AC_SUBST([HAVE_LIB]NAME)
255136644Sache  AC_SUBST([LIB]NAME)
25621308Sache  AC_SUBST([LTLIB]NAME)
25721308Sache  undefine([Name])
25858310Sache  undefine([NAME])
25921308Sache])
26058310Sache
26121308Sachednl Determine the platform dependent parameters needed to use rpath:
26258310Sachednl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
26358310Sachednl hardcode_direct, hardcode_minus_L.
26458310SacheAC_DEFUN([AC_LIB_RPATH],
26558310Sache[
26658310Sache  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
26758310Sache  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
26858310Sache  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
26921308Sache  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
27021308Sache  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
27121308Sache    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
27247558Sache    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
27347558Sache    . ./conftest.sh
27447558Sache    rm -f ./conftest.sh
27547558Sache    acl_cv_rpath=done
27647558Sache  ])
27747558Sache  wl="$acl_cv_wl"
27847558Sache  libext="$acl_cv_libext"
27947558Sache  shlibext="$acl_cv_shlibext"
28047558Sache  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
28147558Sache  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
28247558Sache  hardcode_direct="$acl_cv_hardcode_direct"
28347558Sache  hardcode_minus_L="$acl_cv_hardcode_minus_L"
28447558Sache  dnl Determine whether the user wants rpath handling at all.
28547558Sache  AC_ARG_ENABLE(rpath,
28647558Sache    [  --disable-rpath         do not hardcode runtime library paths],
28721308Sache    :, enable_rpath=yes)
28821308Sache])
28921308Sache
29021308Sachednl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
29121308Sachednl the libraries corresponding to explicit and implicit dependencies.
292165670Sachednl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
293165670SacheAC_DEFUN([AC_LIB_LINKFLAGS_BODY],
294165670Sache[
295165670Sache  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
29621308Sache                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
297165670Sache  dnl By default, look in $includedir and $libdir.
298165670Sache  use_additional=yes
299165670Sache  AC_LIB_WITH_FINAL_PREFIX([
300165670Sache    eval additional_includedir=\"$includedir\"
301165670Sache    eval additional_libdir=\"$libdir\"
302165670Sache  ])
303165670Sache  AC_LIB_ARG_WITH([lib$1-prefix],
304165670Sache[  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
305165670Sache  --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
306165670Sache[
307165670Sache    if test "X$withval" = "Xno"; then
308165670Sache      use_additional=no
309165670Sache    else
310165670Sache      if test "X$withval" = "X"; then
311165670Sache        AC_LIB_WITH_FINAL_PREFIX([
312165670Sache          eval additional_includedir=\"$includedir\"
313165670Sache          eval additional_libdir=\"$libdir\"
314165670Sache        ])
315165670Sache      else
316165670Sache        additional_includedir="$withval/include"
317165670Sache        additional_libdir="$withval/lib"
318165670Sache      fi
319165670Sache    fi
320165670Sache])
321165670Sache  dnl Search the library and its dependencies in $additional_libdir and
322165670Sache  dnl $LDFLAGS. Using breadth-first-seach.
32347558Sache  LIB[]NAME=
32447558Sache  LTLIB[]NAME=
325165670Sache  INC[]NAME=
326165670Sache  rpathdirs=
327165670Sache  ltrpathdirs=
328165670Sache  names_already_handled=
329165670Sache  names_next_round='$1 $2'
33047558Sache  while test -n "$names_next_round"; do
33147558Sache    names_this_round="$names_next_round"
332157184Sache    names_next_round=
33347558Sache    for name in $names_this_round; do
334157184Sache      already_handled=
33521308Sache      for n in $names_already_handled; do
336157184Sache        if test "$n" = "$name"; then
33747558Sache          already_handled=yes
33847558Sache          break
33947558Sache        fi
34021308Sache      done
34147558Sache      if test -z "$already_handled"; then
34247558Sache        names_already_handled="$names_already_handled $name"
34347558Sache        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
34447558Sache        dnl or AC_LIB_HAVE_LINKFLAGS call.
34547558Sache        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
34647558Sache        eval value=\"\$HAVE_LIB$uppername\"
34721308Sache        if test -n "$value"; then
348157184Sache          if test "$value" = yes; then
34921308Sache            eval value=\"\$LIB$uppername\"
35021308Sache            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
35147558Sache            eval value=\"\$LTLIB$uppername\"
35221308Sache            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
35321308Sache          else
35421308Sache            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
35547558Sache            dnl that this library doesn't exist. So just drop it.
35621308Sache            :
35721308Sache          fi
35847558Sache        else
35947558Sache          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
36047558Sache          dnl and the already constructed $LIBNAME/$LTLIBNAME.
36126497Sache          found_dir=
36247558Sache          found_la=
363165670Sache          found_so=
364165670Sache          found_a=
365165670Sache          if test $use_additional = yes; then
366165670Sache            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
36747558Sache              found_dir="$additional_libdir"
36821308Sache              found_so="$additional_libdir/lib$name.$shlibext"
36921308Sache              if test -f "$additional_libdir/lib$name.la"; then
37047558Sache                found_la="$additional_libdir/lib$name.la"
37147558Sache              fi
37247558Sache            else
37347558Sache              if test -f "$additional_libdir/lib$name.$libext"; then
37447558Sache                found_dir="$additional_libdir"
37521308Sache                found_a="$additional_libdir/lib$name.$libext"
37621308Sache                if test -f "$additional_libdir/lib$name.la"; then
37721308Sache                  found_la="$additional_libdir/lib$name.la"
37821308Sache                fi
37921308Sache              fi
38021308Sache            fi
38121308Sache          fi
38221308Sache          if test "X$found_dir" = "X"; then
38321308Sache            for x in $LDFLAGS $LTLIB[]NAME; do
38421308Sache              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
38547558Sache              case "$x" in
38647558Sache                -L*)
38747558Sache                  dir=`echo "X$x" | sed -e 's/^X-L//'`
38821308Sache                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
38947558Sache                    found_dir="$dir"
39047558Sache                    found_so="$dir/lib$name.$shlibext"
391157184Sache                    if test -f "$dir/lib$name.la"; then
39247558Sache                      found_la="$dir/lib$name.la"
393157184Sache                    fi
394157184Sache                  else
39547558Sache                    if test -f "$dir/lib$name.$libext"; then
396157184Sache                      found_dir="$dir"
39721308Sache                      found_a="$dir/lib$name.$libext"
39821308Sache                      if test -f "$dir/lib$name.la"; then
39947558Sache                        found_la="$dir/lib$name.la"
40047558Sache                      fi
40121308Sache                    fi
40221308Sache                  fi
40347558Sache                  ;;
40421308Sache              esac
40521308Sache              if test "X$found_dir" != "X"; then
40647558Sache                break
40747558Sache              fi
40847558Sache            done
40926497Sache          fi
41047558Sache          if test "X$found_dir" != "X"; then
41147558Sache            dnl Found the library.
41221308Sache            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
41321308Sache            if test "X$found_so" != "X"; then
41447558Sache              dnl Linking with a shared library. We attempt to hardcode its
41547558Sache              dnl directory into the executable's runpath, unless it's the
41647558Sache              dnl standard /usr/lib.
41747558Sache              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
41847558Sache                dnl No hardcoding is needed.
41947558Sache                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
42021308Sache              else
42121308Sache                dnl Use an explicit option to hardcode DIR into the resulting
42221308Sache                dnl binary.
42321308Sache                dnl Potentially add DIR to ltrpathdirs.
42447558Sache                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
42547558Sache                haveit=
42647558Sache                for x in $ltrpathdirs; do
42747558Sache                  if test "X$x" = "X$found_dir"; then
42847558Sache                    haveit=yes
42947558Sache                    break
43047558Sache                  fi
431157184Sache                done
432157184Sache                if test -z "$haveit"; then
433165670Sache                  ltrpathdirs="$ltrpathdirs $found_dir"
43447558Sache                fi
43547558Sache                dnl The hardcoding into $LIBNAME is system dependent.
43647558Sache                if test "$hardcode_direct" = yes; then
43747558Sache                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
43847558Sache                  dnl resulting binary.
43947558Sache                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
44047558Sache                else
441157184Sache                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
442157184Sache                    dnl Use an explicit option to hardcode DIR into the resulting
44347558Sache                    dnl binary.
44447558Sache                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
44547558Sache                    dnl Potentially add DIR to rpathdirs.
44647558Sache                    dnl The rpathdirs will be appended to $LIBNAME at the end.
44747558Sache                    haveit=
44847558Sache                    for x in $rpathdirs; do
44947558Sache                      if test "X$x" = "X$found_dir"; then
45047558Sache                        haveit=yes
45147558Sache                        break
45247558Sache                      fi
45347558Sache                    done
45447558Sache                    if test -z "$haveit"; then
45575406Sache                      rpathdirs="$rpathdirs $found_dir"
45647558Sache                    fi
45747558Sache                  else
45847558Sache                    dnl Rely on "-L$found_dir".
45947558Sache                    dnl But don't add it if it's already contained in the LDFLAGS
46047558Sache                    dnl or the already constructed $LIBNAME
46147558Sache                    haveit=
46247558Sache                    for x in $LDFLAGS $LIB[]NAME; do
463157184Sache                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
46447558Sache                      if test "X$x" = "X-L$found_dir"; then
46547558Sache                        haveit=yes
46621308Sache                        break
467                      fi
468                    done
469                    if test -z "$haveit"; then
470                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
471                    fi
472                    if test "$hardcode_minus_L" != no; then
473                      dnl FIXME: Not sure whether we should use
474                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
475                      dnl here.
476                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
477                    else
478                      dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
479                      dnl here, because this doesn't fit in flags passed to the
480                      dnl compiler. So give up. No hardcoding. This affects only
481                      dnl very old systems.
482                      dnl FIXME: Not sure whether we should use
483                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
484                      dnl here.
485                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
486                    fi
487                  fi
488                fi
489              fi
490            else
491              if test "X$found_a" != "X"; then
492                dnl Linking with a static library.
493                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
494              else
495                dnl We shouldn't come here, but anyway it's good to have a
496                dnl fallback.
497                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
498              fi
499            fi
500            dnl Assume the include files are nearby.
501            additional_includedir=
502            case "$found_dir" in
503              */lib | */lib/)
504                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
505                additional_includedir="$basedir/include"
506                ;;
507            esac
508            if test "X$additional_includedir" != "X"; then
509              dnl Potentially add $additional_includedir to $INCNAME.
510              dnl But don't add it
511              dnl   1. if it's the standard /usr/include,
512              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
513              dnl   3. if it's already present in $CPPFLAGS or the already
514              dnl      constructed $INCNAME,
515              dnl   4. if it doesn't exist as a directory.
516              if test "X$additional_includedir" != "X/usr/include"; then
517                haveit=
518                if test "X$additional_includedir" = "X/usr/local/include"; then
519                  if test -n "$GCC"; then
520                    case $host_os in
521                      linux*) haveit=yes;;
522                    esac
523                  fi
524                fi
525                if test -z "$haveit"; then
526                  for x in $CPPFLAGS $INC[]NAME; do
527                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
528                    if test "X$x" = "X-I$additional_includedir"; then
529                      haveit=yes
530                      break
531                    fi
532                  done
533                  if test -z "$haveit"; then
534                    if test -d "$additional_includedir"; then
535                      dnl Really add $additional_includedir to $INCNAME.
536                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
537                    fi
538                  fi
539                fi
540              fi
541            fi
542            dnl Look for dependencies.
543            if test -n "$found_la"; then
544              dnl Read the .la file. It defines the variables
545              dnl dlname, library_names, old_library, dependency_libs, current,
546              dnl age, revision, installed, dlopen, dlpreopen, libdir.
547              save_libdir="$libdir"
548              case "$found_la" in
549                */* | *\\*) . "$found_la" ;;
550                *) . "./$found_la" ;;
551              esac
552              libdir="$save_libdir"
553              dnl We use only dependency_libs.
554              for dep in $dependency_libs; do
555                case "$dep" in
556                  -L*)
557                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
558                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
559                    dnl But don't add it
560                    dnl   1. if it's the standard /usr/lib,
561                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
562                    dnl   3. if it's already present in $LDFLAGS or the already
563                    dnl      constructed $LIBNAME,
564                    dnl   4. if it doesn't exist as a directory.
565                    if test "X$additional_libdir" != "X/usr/lib"; then
566                      haveit=
567                      if test "X$additional_libdir" = "X/usr/local/lib"; then
568                        if test -n "$GCC"; then
569                          case $host_os in
570                            linux*) haveit=yes;;
571                          esac
572                        fi
573                      fi
574                      if test -z "$haveit"; then
575                        haveit=
576                        for x in $LDFLAGS $LIB[]NAME; do
577                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
578                          if test "X$x" = "X-L$additional_libdir"; then
579                            haveit=yes
580                            break
581                          fi
582                        done
583                        if test -z "$haveit"; then
584                          if test -d "$additional_libdir"; then
585                            dnl Really add $additional_libdir to $LIBNAME.
586                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
587                          fi
588                        fi
589                        haveit=
590                        for x in $LDFLAGS $LTLIB[]NAME; do
591                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
592                          if test "X$x" = "X-L$additional_libdir"; then
593                            haveit=yes
594                            break
595                          fi
596                        done
597                        if test -z "$haveit"; then
598                          if test -d "$additional_libdir"; then
599                            dnl Really add $additional_libdir to $LTLIBNAME.
600                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
601                          fi
602                        fi
603                      fi
604                    fi
605                    ;;
606                  -R*)
607                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
608                    if test "$enable_rpath" != no; then
609                      dnl Potentially add DIR to rpathdirs.
610                      dnl The rpathdirs will be appended to $LIBNAME at the end.
611                      haveit=
612                      for x in $rpathdirs; do
613                        if test "X$x" = "X$dir"; then
614                          haveit=yes
615                          break
616                        fi
617                      done
618                      if test -z "$haveit"; then
619                        rpathdirs="$rpathdirs $dir"
620                      fi
621                      dnl Potentially add DIR to ltrpathdirs.
622                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
623                      haveit=
624                      for x in $ltrpathdirs; do
625                        if test "X$x" = "X$dir"; then
626                          haveit=yes
627                          break
628                        fi
629                      done
630                      if test -z "$haveit"; then
631                        ltrpathdirs="$ltrpathdirs $dir"
632                      fi
633                    fi
634                    ;;
635                  -l*)
636                    dnl Handle this in the next round.
637                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
638                    ;;
639                  *.la)
640                    dnl Handle this in the next round. Throw away the .la's
641                    dnl directory; it is already contained in a preceding -L
642                    dnl option.
643                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
644                    ;;
645                  *)
646                    dnl Most likely an immediate library name.
647                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
648                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
649                    ;;
650                esac
651              done
652            fi
653          else
654            dnl Didn't find the library; assume it is in the system directories
655            dnl known to the linker and runtime loader. (All the system
656            dnl directories known to the linker should also be known to the
657            dnl runtime loader, otherwise the system is severely misconfigured.)
658            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
659            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
660          fi
661        fi
662      fi
663    done
664  done
665  if test "X$rpathdirs" != "X"; then
666    if test -n "$hardcode_libdir_separator"; then
667      dnl Weird platform: only the last -rpath option counts, the user must
668      dnl pass all path elements in one option. We can arrange that for a
669      dnl single library, but not when more than one $LIBNAMEs are used.
670      alldirs=
671      for found_dir in $rpathdirs; do
672        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
673      done
674      dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
675      acl_save_libdir="$libdir"
676      libdir="$alldirs"
677      eval flag=\"$hardcode_libdir_flag_spec\"
678      libdir="$acl_save_libdir"
679      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
680    else
681      dnl The -rpath options are cumulative.
682      for found_dir in $rpathdirs; do
683        acl_save_libdir="$libdir"
684        libdir="$found_dir"
685        eval flag=\"$hardcode_libdir_flag_spec\"
686        libdir="$acl_save_libdir"
687        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
688      done
689    fi
690  fi
691  if test "X$ltrpathdirs" != "X"; then
692    dnl When using libtool, the option that works for both libraries and
693    dnl executables is -R. The -R options are cumulative.
694    for found_dir in $ltrpathdirs; do
695      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
696    done
697  fi
698])
699
700dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
701dnl unless already present in VAR.
702dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
703dnl contains two or three consecutive elements that belong together.
704AC_DEFUN([AC_LIB_APPENDTOVAR],
705[
706  for element in [$2]; do
707    haveit=
708    for x in $[$1]; do
709      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
710      if test "X$x" = "X$element"; then
711        haveit=yes
712        break
713      fi
714    done
715    if test -z "$haveit"; then
716      [$1]="${[$1]}${[$1]:+ }$element"
717    fi
718  done
719])
720
721# lib-ld.m4 serial 3 (gettext-0.13)
722dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
723dnl This file is free software, distributed under the terms of the GNU
724dnl General Public License.  As a special exception to the GNU General
725dnl Public License, this file may be distributed as part of a program
726dnl that contains a configuration script generated by Autoconf, under
727dnl the same distribution terms as the rest of that program.
728
729dnl Subroutines of libtool.m4,
730dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
731dnl with libtool.m4.
732
733dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
734AC_DEFUN([AC_LIB_PROG_LD_GNU],
735[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
736[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
737case `$LD -v 2>&1 </dev/null` in
738*GNU* | *'with BFD'*)
739  acl_cv_prog_gnu_ld=yes ;;
740*)
741  acl_cv_prog_gnu_ld=no ;;
742esac])
743with_gnu_ld=$acl_cv_prog_gnu_ld
744])
745
746dnl From libtool-1.4. Sets the variable LD.
747AC_DEFUN([AC_LIB_PROG_LD],
748[AC_ARG_WITH(gnu-ld,
749[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
750test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
751AC_REQUIRE([AC_PROG_CC])dnl
752AC_REQUIRE([AC_CANONICAL_HOST])dnl
753# Prepare PATH_SEPARATOR.
754# The user is always right.
755if test "${PATH_SEPARATOR+set}" != set; then
756  echo "#! /bin/sh" >conf$$.sh
757  echo  "exit 0"   >>conf$$.sh
758  chmod +x conf$$.sh
759  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
760    PATH_SEPARATOR=';'
761  else
762    PATH_SEPARATOR=:
763  fi
764  rm -f conf$$.sh
765fi
766ac_prog=ld
767if test "$GCC" = yes; then
768  # Check if gcc -print-prog-name=ld gives a path.
769  AC_MSG_CHECKING([for ld used by GCC])
770  case $host in
771  *-*-mingw*)
772    # gcc leaves a trailing carriage return which upsets mingw
773    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
774  *)
775    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
776  esac
777  case $ac_prog in
778    # Accept absolute paths.
779    [[\\/]* | [A-Za-z]:[\\/]*)]
780      [re_direlt='/[^/][^/]*/\.\./']
781      # Canonicalize the path of ld
782      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
783      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
784	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
785      done
786      test -z "$LD" && LD="$ac_prog"
787      ;;
788  "")
789    # If it fails, then pretend we aren't using GCC.
790    ac_prog=ld
791    ;;
792  *)
793    # If it is relative, then search for the first ld in PATH.
794    with_gnu_ld=unknown
795    ;;
796  esac
797elif test "$with_gnu_ld" = yes; then
798  AC_MSG_CHECKING([for GNU ld])
799else
800  AC_MSG_CHECKING([for non-GNU ld])
801fi
802AC_CACHE_VAL(acl_cv_path_LD,
803[if test -z "$LD"; then
804  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
805  for ac_dir in $PATH; do
806    test -z "$ac_dir" && ac_dir=.
807    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
808      acl_cv_path_LD="$ac_dir/$ac_prog"
809      # Check to see if the program is GNU ld.  I'd rather use --version,
810      # but apparently some GNU ld's only accept -v.
811      # Break only if it was the GNU/non-GNU ld that we prefer.
812      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
813      *GNU* | *'with BFD'*)
814	test "$with_gnu_ld" != no && break ;;
815      *)
816	test "$with_gnu_ld" != yes && break ;;
817      esac
818    fi
819  done
820  IFS="$ac_save_ifs"
821else
822  acl_cv_path_LD="$LD" # Let the user override the test with a path.
823fi])
824LD="$acl_cv_path_LD"
825if test -n "$LD"; then
826  AC_MSG_RESULT($LD)
827else
828  AC_MSG_RESULT(no)
829fi
830test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
831AC_LIB_PROG_LD_GNU
832])
833
834# Do all the work for Automake.  This macro actually does too much --
835# some checks are only needed if your package does certain things.
836# But this isn't really a big deal.
837
838# serial 1
839
840dnl Usage:
841dnl AM_INIT_AUTOMAKE(package,version, [no-define])
842
843AC_DEFUN([AM_INIT_AUTOMAKE],
844[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
845AC_REQUIRE([AC_PROG_INSTALL])
846PACKAGE=[$1]
847AC_SUBST(PACKAGE)
848VERSION=[$2]
849AC_SUBST(VERSION)
850dnl test to see if srcdir already configured
851if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
852  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
853fi
854ifelse([$3],,
855AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
856AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
857AC_REQUIRE([AM_SANITY_CHECK])
858AC_REQUIRE([AC_ARG_PROGRAM])
859dnl FIXME This is truly gross.
860missing_dir=`cd $ac_aux_dir && pwd`
861AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
862AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
863AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
864AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
865AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
866AC_REQUIRE([AC_PROG_MAKE_SET])])
867
868# Copyright 2002  Free Software Foundation, Inc.
869
870# This program is free software; you can redistribute it and/or modify
871# it under the terms of the GNU General Public License as published by
872# the Free Software Foundation; either version 2, or (at your option)
873# any later version.
874
875# This program is distributed in the hope that it will be useful,
876# but WITHOUT ANY WARRANTY; without even the implied warranty of
877# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
878# GNU General Public License for more details.
879
880# You should have received a copy of the GNU General Public License
881# along with this program; if not, write to the Free Software
882# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
883
884# AM_AUTOMAKE_VERSION(VERSION)
885# ----------------------------
886# Automake X.Y traces this macro to ensure aclocal.m4 has been
887# generated from the m4 files accompanying Automake X.Y.
888AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
889
890# AM_SET_CURRENT_AUTOMAKE_VERSION
891# -------------------------------
892# Call AM_AUTOMAKE_VERSION so it can be traced.
893# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
894AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
895	 [AM_AUTOMAKE_VERSION([1.4-p6])])
896
897#
898# Check to make sure that the build environment is sane.
899#
900
901AC_DEFUN([AM_SANITY_CHECK],
902[AC_MSG_CHECKING([whether build environment is sane])
903# Just in case
904sleep 1
905echo timestamp > conftestfile
906# Do `set' in a subshell so we don't clobber the current shell's
907# arguments.  Must try -L first in case configure is actually a
908# symlink; some systems play weird games with the mod time of symlinks
909# (eg FreeBSD returns the mod time of the symlink's containing
910# directory).
911if (
912   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
913   if test "[$]*" = "X"; then
914      # -L didn't work.
915      set X `ls -t $srcdir/configure conftestfile`
916   fi
917   if test "[$]*" != "X $srcdir/configure conftestfile" \
918      && test "[$]*" != "X conftestfile $srcdir/configure"; then
919
920      # If neither matched, then we have a broken ls.  This can happen
921      # if, for instance, CONFIG_SHELL is bash and it inherits a
922      # broken ls alias from the environment.  This has actually
923      # happened.  Such a system could not be considered "sane".
924      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
925alias in your environment])
926   fi
927
928   test "[$]2" = conftestfile
929   )
930then
931   # Ok.
932   :
933else
934   AC_MSG_ERROR([newly created file is older than distributed files!
935Check your system clock])
936fi
937rm -f conftest*
938AC_MSG_RESULT(yes)])
939
940dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
941dnl The program must properly implement --version.
942AC_DEFUN([AM_MISSING_PROG],
943[AC_MSG_CHECKING(for working $2)
944# Run test in a subshell; some versions of sh will print an error if
945# an executable is not found, even if stderr is redirected.
946# Redirect stdin to placate older versions of autoconf.  Sigh.
947if ($2 --version) < /dev/null > /dev/null 2>&1; then
948   $1=$2
949   AC_MSG_RESULT(found)
950else
951   $1="$3/missing $2"
952   AC_MSG_RESULT(missing)
953fi
954AC_SUBST($1)])
955
956