~hamo/ubuntu/precise/grub2/grub2.hi_res

« back to all changes in this revision

Viewing changes to m4/lib-link.m4

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson, Colin Watson, Evan Broder, Mario Limonciello
  • Date: 2010-11-24 13:59:55 UTC
  • mfrom: (1.17.6 upstream) (17.6.15 experimental)
  • Revision ID: james.westby@ubuntu.com-20101124135955-r6ii5sepayr7jt53
Tags: 1.99~20101124-1ubuntu1
[ Colin Watson ]
* Resynchronise with Debian experimental.  Remaining changes:
  - Adjust for default Ubuntu boot options ("quiet splash").
  - Default to hiding the menu; holding down Shift at boot will show it.
  - Set a monochromatic theme for Ubuntu.
  - Apply Ubuntu GRUB Legacy changes to legacy update-grub script: title,
    recovery mode, quiet option, tweak how memtest86+ is displayed, and
    use UUIDs where appropriate.
  - Fix backslash-escaping in merge_debconf_into_conf.
  - Remove "GNU/Linux" from default distributor string.
  - Add crashkernel= options if kdump and makedumpfile are available.
  - If other operating systems are installed, then automatically unhide
    the menu.  Otherwise, if GRUB_HIDDEN_TIMEOUT is 0, then use keystatus
    if available to check whether Shift is pressed.  If it is, show the
    menu, otherwise boot immediately.  If keystatus is not available, then
    fall back to a short delay interruptible with Escape.
  - Allow Shift to interrupt 'sleep --interruptible'.
  - Don't display introductory message about line editing unless we're
    actually offering a shell prompt.  Don't clear the screen just before
    booting if we never drew the menu in the first place.
  - Remove some verbose messages printed before reading the configuration
    file.
  - Suppress progress messages as the kernel and initrd load for
    non-recovery kernel menu entries.
  - Change prepare_grub_to_access_device to handle filesystems
    loop-mounted on file images.
  - Ignore devices loop-mounted from files in 10_linux.
  - Show the boot menu if the previous boot failed, that is if it failed
    to get to the end of one of the normal runlevels.
  - Don't generate /boot/grub/device.map during grub-install or
    grub-mkconfig by default.
  - Adjust upgrade version checks for Ubuntu.
  - Don't display "GRUB loading" unless Shift is held down.
  - Adjust versions of grub-doc and grub-legacy-doc conflicts to tolerate
    our backport of the grub-doc split.
  - Fix LVM/RAID probing in the absence of /boot/grub/device.map.
  - Look for .mo files in /usr/share/locale-langpack as well, in
    preference.
  - Make sure GRUB_TIMEOUT isn't quoted unnecessarily.
  - Probe all devices in 'grub-probe --target=drive' if
    /boot/grub/device.map is missing.
  - Build-depend on qemu-kvm rather than qemu-system for grub-pc tests.
  - Use qemu rather than qemu-system-i386.
  - Program vesafb on BIOS systems rather than efifb.
  - Add a grub-rescue-efi-amd64 package containing a rescue CD-ROM image
    for EFI-AMD64.
  - On Wubi, don't ask for an install device, but just update wubildr
    using the diverted grub-install.
  - When embedding the core image in a post-MBR gap, check for and avoid
    sectors matching any of a list of known signatures.
  - Disable video_bochs and video_cirrus on PC BIOS systems, as probing
    PCI space seems to break on some systems.
* Downgrade "ACPI shutdown failed" error to a debug message, since it can
  cause spurious test failures.

[ Evan Broder ]
* Enable lua from grub-extras.
* Incorporate the bitop library into lua.
* Add enum_pci function to grub module in lua.
* Switch back to gfxpayload=keep by default, unless the video hardware
  is known to not support it.

[ Mario Limonciello ]
* Built part_msdos and vfat into bootx64.efi (LP: #677758)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# lib-link.m4 serial 25 (gettext-0.18.2)
 
2
dnl Copyright (C) 2001-2010 Free Software Foundation, Inc.
 
3
dnl This file is free software; the Free Software Foundation
 
4
dnl gives unlimited permission to copy and/or distribute it,
 
5
dnl with or without modifications, as long as this notice is preserved.
 
6
 
 
7
dnl From Bruno Haible.
 
8
 
 
9
AC_PREREQ([2.54])
 
10
 
 
11
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
 
12
dnl the libraries corresponding to explicit and implicit dependencies.
 
13
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
 
14
dnl augments the CPPFLAGS variable.
 
15
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
 
16
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
 
17
AC_DEFUN([AC_LIB_LINKFLAGS],
 
18
[
 
19
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
 
20
  AC_REQUIRE([AC_LIB_RPATH])
 
21
  pushdef([Name],[m4_translit([$1],[./+-], [____])])
 
22
  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
 
23
                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
 
24
  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
 
25
    AC_LIB_LINKFLAGS_BODY([$1], [$2])
 
26
    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
 
27
    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
 
28
    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
 
29
    ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
 
30
  ])
 
31
  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
 
32
  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
 
33
  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
 
34
  LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
 
35
  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
 
36
  AC_SUBST([LIB]NAME)
 
37
  AC_SUBST([LTLIB]NAME)
 
38
  AC_SUBST([LIB]NAME[_PREFIX])
 
39
  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
 
40
  dnl results of this search when this library appears as a dependency.
 
41
  HAVE_LIB[]NAME=yes
 
42
  popdef([NAME])
 
43
  popdef([Name])
 
44
])
 
45
 
 
46
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
 
47
dnl searches for libname and the libraries corresponding to explicit and
 
48
dnl implicit dependencies, together with the specified include files and
 
49
dnl the ability to compile and link the specified testcode. The missing-message
 
50
dnl defaults to 'no' and may contain additional hints for the user.
 
51
dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
 
52
dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
 
53
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
 
54
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
 
55
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
 
56
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
 
57
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
 
58
[
 
59
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
 
60
  AC_REQUIRE([AC_LIB_RPATH])
 
61
  pushdef([Name],[m4_translit([$1],[./+-], [____])])
 
62
  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
 
63
                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
 
64
 
 
65
  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
 
66
  dnl accordingly.
 
67
  AC_LIB_LINKFLAGS_BODY([$1], [$2])
 
68
 
 
69
  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
 
70
  dnl because if the user has installed lib[]Name and not disabled its use
 
71
  dnl via --without-lib[]Name-prefix, he wants to use it.
 
72
  ac_save_CPPFLAGS="$CPPFLAGS"
 
73
  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
 
74
 
 
75
  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
 
76
    ac_save_LIBS="$LIBS"
 
77
    dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
 
78
    dnl because these -l options might require -L options that are present in
 
79
    dnl LIBS. -l options benefit only from the -L options listed before it.
 
80
    dnl Otherwise, add it to the front of LIBS, because it may be a static
 
81
    dnl library that depends on another static library that is present in LIBS.
 
82
    dnl Static libraries benefit only from the static libraries listed after
 
83
    dnl it.
 
84
    case " $LIB[]NAME" in
 
85
      *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
 
86
      *)       LIBS="$LIB[]NAME $LIBS" ;;
 
87
    esac
 
88
    AC_LINK_IFELSE(
 
89
      [AC_LANG_PROGRAM([[$3]], [[$4]])],
 
90
      [ac_cv_lib[]Name=yes],
 
91
      [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
 
92
    LIBS="$ac_save_LIBS"
 
93
  ])
 
94
  if test "$ac_cv_lib[]Name" = yes; then
 
95
    HAVE_LIB[]NAME=yes
 
96
    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
 
97
    AC_MSG_CHECKING([how to link with lib[]$1])
 
98
    AC_MSG_RESULT([$LIB[]NAME])
 
99
  else
 
100
    HAVE_LIB[]NAME=no
 
101
    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
 
102
    dnl $INC[]NAME either.
 
103
    CPPFLAGS="$ac_save_CPPFLAGS"
 
104
    LIB[]NAME=
 
105
    LTLIB[]NAME=
 
106
    LIB[]NAME[]_PREFIX=
 
107
  fi
 
108
  AC_SUBST([HAVE_LIB]NAME)
 
109
  AC_SUBST([LIB]NAME)
 
110
  AC_SUBST([LTLIB]NAME)
 
111
  AC_SUBST([LIB]NAME[_PREFIX])
 
112
  popdef([NAME])
 
113
  popdef([Name])
 
114
])
 
115
 
 
116
dnl Determine the platform dependent parameters needed to use rpath:
 
117
dnl   acl_libext,
 
118
dnl   acl_shlibext,
 
119
dnl   acl_hardcode_libdir_flag_spec,
 
120
dnl   acl_hardcode_libdir_separator,
 
121
dnl   acl_hardcode_direct,
 
122
dnl   acl_hardcode_minus_L.
 
123
AC_DEFUN([AC_LIB_RPATH],
 
124
[
 
125
  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
 
126
  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
 
127
  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
 
128
  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
 
129
  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
 
130
  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
 
131
  AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
 
132
    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
 
133
    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
 
134
    . ./conftest.sh
 
135
    rm -f ./conftest.sh
 
136
    acl_cv_rpath=done
 
137
  ])
 
138
  wl="$acl_cv_wl"
 
139
  acl_libext="$acl_cv_libext"
 
140
  acl_shlibext="$acl_cv_shlibext"
 
141
  acl_libname_spec="$acl_cv_libname_spec"
 
142
  acl_library_names_spec="$acl_cv_library_names_spec"
 
143
  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
 
144
  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
 
145
  acl_hardcode_direct="$acl_cv_hardcode_direct"
 
146
  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
 
147
  dnl Determine whether the user wants rpath handling at all.
 
148
  AC_ARG_ENABLE([rpath],
 
149
    [  --disable-rpath         do not hardcode runtime library paths],
 
150
    :, enable_rpath=yes)
 
151
])
 
152
 
 
153
dnl AC_LIB_FROMPACKAGE(name, package)
 
154
dnl declares that libname comes from the given package. The configure file
 
155
dnl will then not have a --with-libname-prefix option but a
 
156
dnl --with-package-prefix option. Several libraries can come from the same
 
157
dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
 
158
dnl macro call that searches for libname.
 
159
AC_DEFUN([AC_LIB_FROMPACKAGE],
 
160
[
 
161
  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
 
162
                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
 
163
  define([acl_frompackage_]NAME, [$2])
 
164
  popdef([NAME])
 
165
  pushdef([PACK],[$2])
 
166
  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
 
167
                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
 
168
  define([acl_libsinpackage_]PACKUP,
 
169
    m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
 
170
  popdef([PACKUP])
 
171
  popdef([PACK])
 
172
])
 
173
 
 
174
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
 
175
dnl the libraries corresponding to explicit and implicit dependencies.
 
176
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
 
177
dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
 
178
dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
 
179
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
 
180
[
 
181
  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
 
182
  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
 
183
                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
 
184
  pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
 
185
  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
 
186
                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
 
187
  pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
 
188
  dnl Autoconf >= 2.61 supports dots in --with options.
 
189
  pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)])
 
190
  dnl By default, look in $includedir and $libdir.
 
191
  use_additional=yes
 
192
  AC_LIB_WITH_FINAL_PREFIX([
 
193
    eval additional_includedir=\"$includedir\"
 
194
    eval additional_libdir=\"$libdir\"
 
195
  ])
 
196
  AC_ARG_WITH(P_A_C_K[-prefix],
 
197
[[  --with-]]P_A_C_K[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and DIR/lib
 
198
  --without-]]P_A_C_K[[-prefix     don't search for ]PACKLIBS[ in includedir and libdir]],
 
199
[
 
200
    if test "X$withval" = "Xno"; then
 
201
      use_additional=no
 
202
    else
 
203
      if test "X$withval" = "X"; then
 
204
        AC_LIB_WITH_FINAL_PREFIX([
 
205
          eval additional_includedir=\"$includedir\"
 
206
          eval additional_libdir=\"$libdir\"
 
207
        ])
 
208
      else
 
209
        additional_includedir="$withval/include"
 
210
        additional_libdir="$withval/$acl_libdirstem"
 
211
        if test "$acl_libdirstem2" != "$acl_libdirstem" \
 
212
           && ! test -d "$withval/$acl_libdirstem"; then
 
213
          additional_libdir="$withval/$acl_libdirstem2"
 
214
        fi
 
215
      fi
 
216
    fi
 
217
])
 
218
  dnl Search the library and its dependencies in $additional_libdir and
 
219
  dnl $LDFLAGS. Using breadth-first-seach.
 
220
  LIB[]NAME=
 
221
  LTLIB[]NAME=
 
222
  INC[]NAME=
 
223
  LIB[]NAME[]_PREFIX=
 
224
  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
 
225
  dnl computed. So it has to be reset here.
 
226
  HAVE_LIB[]NAME=
 
227
  rpathdirs=
 
228
  ltrpathdirs=
 
229
  names_already_handled=
 
230
  names_next_round='$1 $2'
 
231
  while test -n "$names_next_round"; do
 
232
    names_this_round="$names_next_round"
 
233
    names_next_round=
 
234
    for name in $names_this_round; do
 
235
      already_handled=
 
236
      for n in $names_already_handled; do
 
237
        if test "$n" = "$name"; then
 
238
          already_handled=yes
 
239
          break
 
240
        fi
 
241
      done
 
242
      if test -z "$already_handled"; then
 
243
        names_already_handled="$names_already_handled $name"
 
244
        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
 
245
        dnl or AC_LIB_HAVE_LINKFLAGS call.
 
246
        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
 
247
        eval value=\"\$HAVE_LIB$uppername\"
 
248
        if test -n "$value"; then
 
249
          if test "$value" = yes; then
 
250
            eval value=\"\$LIB$uppername\"
 
251
            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
 
252
            eval value=\"\$LTLIB$uppername\"
 
253
            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
 
254
          else
 
255
            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
 
256
            dnl that this library doesn't exist. So just drop it.
 
257
            :
 
258
          fi
 
259
        else
 
260
          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
 
261
          dnl and the already constructed $LIBNAME/$LTLIBNAME.
 
262
          found_dir=
 
263
          found_la=
 
264
          found_so=
 
265
          found_a=
 
266
          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
 
267
          if test -n "$acl_shlibext"; then
 
268
            shrext=".$acl_shlibext"             # typically: shrext=.so
 
269
          else
 
270
            shrext=
 
271
          fi
 
272
          if test $use_additional = yes; then
 
273
            dir="$additional_libdir"
 
274
            dnl The same code as in the loop below:
 
275
            dnl First look for a shared library.
 
276
            if test -n "$acl_shlibext"; then
 
277
              if test -f "$dir/$libname$shrext"; then
 
278
                found_dir="$dir"
 
279
                found_so="$dir/$libname$shrext"
 
280
              else
 
281
                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
 
282
                  ver=`(cd "$dir" && \
 
283
                        for f in "$libname$shrext".*; do echo "$f"; done \
 
284
                        | sed -e "s,^$libname$shrext\\\\.,," \
 
285
                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
 
286
                        | sed 1q ) 2>/dev/null`
 
287
                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
 
288
                    found_dir="$dir"
 
289
                    found_so="$dir/$libname$shrext.$ver"
 
290
                  fi
 
291
                else
 
292
                  eval library_names=\"$acl_library_names_spec\"
 
293
                  for f in $library_names; do
 
294
                    if test -f "$dir/$f"; then
 
295
                      found_dir="$dir"
 
296
                      found_so="$dir/$f"
 
297
                      break
 
298
                    fi
 
299
                  done
 
300
                fi
 
301
              fi
 
302
            fi
 
303
            dnl Then look for a static library.
 
304
            if test "X$found_dir" = "X"; then
 
305
              if test -f "$dir/$libname.$acl_libext"; then
 
306
                found_dir="$dir"
 
307
                found_a="$dir/$libname.$acl_libext"
 
308
              fi
 
309
            fi
 
310
            if test "X$found_dir" != "X"; then
 
311
              if test -f "$dir/$libname.la"; then
 
312
                found_la="$dir/$libname.la"
 
313
              fi
 
314
            fi
 
315
          fi
 
316
          if test "X$found_dir" = "X"; then
 
317
            for x in $LDFLAGS $LTLIB[]NAME; do
 
318
              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 
319
              case "$x" in
 
320
                -L*)
 
321
                  dir=`echo "X$x" | sed -e 's/^X-L//'`
 
322
                  dnl First look for a shared library.
 
323
                  if test -n "$acl_shlibext"; then
 
324
                    if test -f "$dir/$libname$shrext"; then
 
325
                      found_dir="$dir"
 
326
                      found_so="$dir/$libname$shrext"
 
327
                    else
 
328
                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
 
329
                        ver=`(cd "$dir" && \
 
330
                              for f in "$libname$shrext".*; do echo "$f"; done \
 
331
                              | sed -e "s,^$libname$shrext\\\\.,," \
 
332
                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
 
333
                              | sed 1q ) 2>/dev/null`
 
334
                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
 
335
                          found_dir="$dir"
 
336
                          found_so="$dir/$libname$shrext.$ver"
 
337
                        fi
 
338
                      else
 
339
                        eval library_names=\"$acl_library_names_spec\"
 
340
                        for f in $library_names; do
 
341
                          if test -f "$dir/$f"; then
 
342
                            found_dir="$dir"
 
343
                            found_so="$dir/$f"
 
344
                            break
 
345
                          fi
 
346
                        done
 
347
                      fi
 
348
                    fi
 
349
                  fi
 
350
                  dnl Then look for a static library.
 
351
                  if test "X$found_dir" = "X"; then
 
352
                    if test -f "$dir/$libname.$acl_libext"; then
 
353
                      found_dir="$dir"
 
354
                      found_a="$dir/$libname.$acl_libext"
 
355
                    fi
 
356
                  fi
 
357
                  if test "X$found_dir" != "X"; then
 
358
                    if test -f "$dir/$libname.la"; then
 
359
                      found_la="$dir/$libname.la"
 
360
                    fi
 
361
                  fi
 
362
                  ;;
 
363
              esac
 
364
              if test "X$found_dir" != "X"; then
 
365
                break
 
366
              fi
 
367
            done
 
368
          fi
 
369
          if test "X$found_dir" != "X"; then
 
370
            dnl Found the library.
 
371
            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
 
372
            if test "X$found_so" != "X"; then
 
373
              dnl Linking with a shared library. We attempt to hardcode its
 
374
              dnl directory into the executable's runpath, unless it's the
 
375
              dnl standard /usr/lib.
 
376
              if test "$enable_rpath" = no \
 
377
                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
 
378
                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
 
379
                dnl No hardcoding is needed.
 
380
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
 
381
              else
 
382
                dnl Use an explicit option to hardcode DIR into the resulting
 
383
                dnl binary.
 
384
                dnl Potentially add DIR to ltrpathdirs.
 
385
                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
 
386
                haveit=
 
387
                for x in $ltrpathdirs; do
 
388
                  if test "X$x" = "X$found_dir"; then
 
389
                    haveit=yes
 
390
                    break
 
391
                  fi
 
392
                done
 
393
                if test -z "$haveit"; then
 
394
                  ltrpathdirs="$ltrpathdirs $found_dir"
 
395
                fi
 
396
                dnl The hardcoding into $LIBNAME is system dependent.
 
397
                if test "$acl_hardcode_direct" = yes; then
 
398
                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
 
399
                  dnl resulting binary.
 
400
                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
 
401
                else
 
402
                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
 
403
                    dnl Use an explicit option to hardcode DIR into the resulting
 
404
                    dnl binary.
 
405
                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
 
406
                    dnl Potentially add DIR to rpathdirs.
 
407
                    dnl The rpathdirs will be appended to $LIBNAME at the end.
 
408
                    haveit=
 
409
                    for x in $rpathdirs; do
 
410
                      if test "X$x" = "X$found_dir"; then
 
411
                        haveit=yes
 
412
                        break
 
413
                      fi
 
414
                    done
 
415
                    if test -z "$haveit"; then
 
416
                      rpathdirs="$rpathdirs $found_dir"
 
417
                    fi
 
418
                  else
 
419
                    dnl Rely on "-L$found_dir".
 
420
                    dnl But don't add it if it's already contained in the LDFLAGS
 
421
                    dnl or the already constructed $LIBNAME
 
422
                    haveit=
 
423
                    for x in $LDFLAGS $LIB[]NAME; do
 
424
                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 
425
                      if test "X$x" = "X-L$found_dir"; then
 
426
                        haveit=yes
 
427
                        break
 
428
                      fi
 
429
                    done
 
430
                    if test -z "$haveit"; then
 
431
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
 
432
                    fi
 
433
                    if test "$acl_hardcode_minus_L" != no; then
 
434
                      dnl FIXME: Not sure whether we should use
 
435
                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
 
436
                      dnl here.
 
437
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
 
438
                    else
 
439
                      dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
 
440
                      dnl here, because this doesn't fit in flags passed to the
 
441
                      dnl compiler. So give up. No hardcoding. This affects only
 
442
                      dnl very old systems.
 
443
                      dnl FIXME: Not sure whether we should use
 
444
                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
 
445
                      dnl here.
 
446
                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
 
447
                    fi
 
448
                  fi
 
449
                fi
 
450
              fi
 
451
            else
 
452
              if test "X$found_a" != "X"; then
 
453
                dnl Linking with a static library.
 
454
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
 
455
              else
 
456
                dnl We shouldn't come here, but anyway it's good to have a
 
457
                dnl fallback.
 
458
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
 
459
              fi
 
460
            fi
 
461
            dnl Assume the include files are nearby.
 
462
            additional_includedir=
 
463
            case "$found_dir" in
 
464
              */$acl_libdirstem | */$acl_libdirstem/)
 
465
                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
 
466
                if test "$name" = '$1'; then
 
467
                  LIB[]NAME[]_PREFIX="$basedir"
 
468
                fi
 
469
                additional_includedir="$basedir/include"
 
470
                ;;
 
471
              */$acl_libdirstem2 | */$acl_libdirstem2/)
 
472
                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
 
473
                if test "$name" = '$1'; then
 
474
                  LIB[]NAME[]_PREFIX="$basedir"
 
475
                fi
 
476
                additional_includedir="$basedir/include"
 
477
                ;;
 
478
            esac
 
479
            if test "X$additional_includedir" != "X"; then
 
480
              dnl Potentially add $additional_includedir to $INCNAME.
 
481
              dnl But don't add it
 
482
              dnl   1. if it's the standard /usr/include,
 
483
              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
 
484
              dnl   3. if it's already present in $CPPFLAGS or the already
 
485
              dnl      constructed $INCNAME,
 
486
              dnl   4. if it doesn't exist as a directory.
 
487
              if test "X$additional_includedir" != "X/usr/include"; then
 
488
                haveit=
 
489
                if test "X$additional_includedir" = "X/usr/local/include"; then
 
490
                  if test -n "$GCC"; then
 
491
                    case $host_os in
 
492
                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
 
493
                    esac
 
494
                  fi
 
495
                fi
 
496
                if test -z "$haveit"; then
 
497
                  for x in $CPPFLAGS $INC[]NAME; do
 
498
                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 
499
                    if test "X$x" = "X-I$additional_includedir"; then
 
500
                      haveit=yes
 
501
                      break
 
502
                    fi
 
503
                  done
 
504
                  if test -z "$haveit"; then
 
505
                    if test -d "$additional_includedir"; then
 
506
                      dnl Really add $additional_includedir to $INCNAME.
 
507
                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
 
508
                    fi
 
509
                  fi
 
510
                fi
 
511
              fi
 
512
            fi
 
513
            dnl Look for dependencies.
 
514
            if test -n "$found_la"; then
 
515
              dnl Read the .la file. It defines the variables
 
516
              dnl dlname, library_names, old_library, dependency_libs, current,
 
517
              dnl age, revision, installed, dlopen, dlpreopen, libdir.
 
518
              save_libdir="$libdir"
 
519
              case "$found_la" in
 
520
                */* | *\\*) . "$found_la" ;;
 
521
                *) . "./$found_la" ;;
 
522
              esac
 
523
              libdir="$save_libdir"
 
524
              dnl We use only dependency_libs.
 
525
              for dep in $dependency_libs; do
 
526
                case "$dep" in
 
527
                  -L*)
 
528
                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
 
529
                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
 
530
                    dnl But don't add it
 
531
                    dnl   1. if it's the standard /usr/lib,
 
532
                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
 
533
                    dnl   3. if it's already present in $LDFLAGS or the already
 
534
                    dnl      constructed $LIBNAME,
 
535
                    dnl   4. if it doesn't exist as a directory.
 
536
                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
 
537
                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
 
538
                      haveit=
 
539
                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
 
540
                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
 
541
                        if test -n "$GCC"; then
 
542
                          case $host_os in
 
543
                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
 
544
                          esac
 
545
                        fi
 
546
                      fi
 
547
                      if test -z "$haveit"; then
 
548
                        haveit=
 
549
                        for x in $LDFLAGS $LIB[]NAME; do
 
550
                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 
551
                          if test "X$x" = "X-L$additional_libdir"; then
 
552
                            haveit=yes
 
553
                            break
 
554
                          fi
 
555
                        done
 
556
                        if test -z "$haveit"; then
 
557
                          if test -d "$additional_libdir"; then
 
558
                            dnl Really add $additional_libdir to $LIBNAME.
 
559
                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
 
560
                          fi
 
561
                        fi
 
562
                        haveit=
 
563
                        for x in $LDFLAGS $LTLIB[]NAME; do
 
564
                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 
565
                          if test "X$x" = "X-L$additional_libdir"; then
 
566
                            haveit=yes
 
567
                            break
 
568
                          fi
 
569
                        done
 
570
                        if test -z "$haveit"; then
 
571
                          if test -d "$additional_libdir"; then
 
572
                            dnl Really add $additional_libdir to $LTLIBNAME.
 
573
                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
 
574
                          fi
 
575
                        fi
 
576
                      fi
 
577
                    fi
 
578
                    ;;
 
579
                  -R*)
 
580
                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
 
581
                    if test "$enable_rpath" != no; then
 
582
                      dnl Potentially add DIR to rpathdirs.
 
583
                      dnl The rpathdirs will be appended to $LIBNAME at the end.
 
584
                      haveit=
 
585
                      for x in $rpathdirs; do
 
586
                        if test "X$x" = "X$dir"; then
 
587
                          haveit=yes
 
588
                          break
 
589
                        fi
 
590
                      done
 
591
                      if test -z "$haveit"; then
 
592
                        rpathdirs="$rpathdirs $dir"
 
593
                      fi
 
594
                      dnl Potentially add DIR to ltrpathdirs.
 
595
                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
 
596
                      haveit=
 
597
                      for x in $ltrpathdirs; do
 
598
                        if test "X$x" = "X$dir"; then
 
599
                          haveit=yes
 
600
                          break
 
601
                        fi
 
602
                      done
 
603
                      if test -z "$haveit"; then
 
604
                        ltrpathdirs="$ltrpathdirs $dir"
 
605
                      fi
 
606
                    fi
 
607
                    ;;
 
608
                  -l*)
 
609
                    dnl Handle this in the next round.
 
610
                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
 
611
                    ;;
 
612
                  *.la)
 
613
                    dnl Handle this in the next round. Throw away the .la's
 
614
                    dnl directory; it is already contained in a preceding -L
 
615
                    dnl option.
 
616
                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
 
617
                    ;;
 
618
                  *)
 
619
                    dnl Most likely an immediate library name.
 
620
                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
 
621
                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
 
622
                    ;;
 
623
                esac
 
624
              done
 
625
            fi
 
626
          else
 
627
            dnl Didn't find the library; assume it is in the system directories
 
628
            dnl known to the linker and runtime loader. (All the system
 
629
            dnl directories known to the linker should also be known to the
 
630
            dnl runtime loader, otherwise the system is severely misconfigured.)
 
631
            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
 
632
            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
 
633
          fi
 
634
        fi
 
635
      fi
 
636
    done
 
637
  done
 
638
  if test "X$rpathdirs" != "X"; then
 
639
    if test -n "$acl_hardcode_libdir_separator"; then
 
640
      dnl Weird platform: only the last -rpath option counts, the user must
 
641
      dnl pass all path elements in one option. We can arrange that for a
 
642
      dnl single library, but not when more than one $LIBNAMEs are used.
 
643
      alldirs=
 
644
      for found_dir in $rpathdirs; do
 
645
        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
 
646
      done
 
647
      dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
 
648
      acl_save_libdir="$libdir"
 
649
      libdir="$alldirs"
 
650
      eval flag=\"$acl_hardcode_libdir_flag_spec\"
 
651
      libdir="$acl_save_libdir"
 
652
      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
 
653
    else
 
654
      dnl The -rpath options are cumulative.
 
655
      for found_dir in $rpathdirs; do
 
656
        acl_save_libdir="$libdir"
 
657
        libdir="$found_dir"
 
658
        eval flag=\"$acl_hardcode_libdir_flag_spec\"
 
659
        libdir="$acl_save_libdir"
 
660
        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
 
661
      done
 
662
    fi
 
663
  fi
 
664
  if test "X$ltrpathdirs" != "X"; then
 
665
    dnl When using libtool, the option that works for both libraries and
 
666
    dnl executables is -R. The -R options are cumulative.
 
667
    for found_dir in $ltrpathdirs; do
 
668
      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
 
669
    done
 
670
  fi
 
671
  popdef([P_A_C_K])
 
672
  popdef([PACKLIBS])
 
673
  popdef([PACKUP])
 
674
  popdef([PACK])
 
675
  popdef([NAME])
 
676
])
 
677
 
 
678
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
 
679
dnl unless already present in VAR.
 
680
dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
 
681
dnl contains two or three consecutive elements that belong together.
 
682
AC_DEFUN([AC_LIB_APPENDTOVAR],
 
683
[
 
684
  for element in [$2]; do
 
685
    haveit=
 
686
    for x in $[$1]; do
 
687
      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
 
688
      if test "X$x" = "X$element"; then
 
689
        haveit=yes
 
690
        break
 
691
      fi
 
692
    done
 
693
    if test -z "$haveit"; then
 
694
      [$1]="${[$1]}${[$1]:+ }$element"
 
695
    fi
 
696
  done
 
697
])
 
698
 
 
699
dnl For those cases where a variable contains several -L and -l options
 
700
dnl referring to unknown libraries and directories, this macro determines the
 
701
dnl necessary additional linker options for the runtime path.
 
702
dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
 
703
dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
 
704
dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
 
705
dnl otherwise linking without libtool is assumed.
 
706
AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
 
707
[
 
708
  AC_REQUIRE([AC_LIB_RPATH])
 
709
  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
 
710
  $1=
 
711
  if test "$enable_rpath" != no; then
 
712
    if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
 
713
      dnl Use an explicit option to hardcode directories into the resulting
 
714
      dnl binary.
 
715
      rpathdirs=
 
716
      next=
 
717
      for opt in $2; do
 
718
        if test -n "$next"; then
 
719
          dir="$next"
 
720
          dnl No need to hardcode the standard /usr/lib.
 
721
          if test "X$dir" != "X/usr/$acl_libdirstem" \
 
722
             && test "X$dir" != "X/usr/$acl_libdirstem2"; then
 
723
            rpathdirs="$rpathdirs $dir"
 
724
          fi
 
725
          next=
 
726
        else
 
727
          case $opt in
 
728
            -L) next=yes ;;
 
729
            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
 
730
                 dnl No need to hardcode the standard /usr/lib.
 
731
                 if test "X$dir" != "X/usr/$acl_libdirstem" \
 
732
                    && test "X$dir" != "X/usr/$acl_libdirstem2"; then
 
733
                   rpathdirs="$rpathdirs $dir"
 
734
                 fi
 
735
                 next= ;;
 
736
            *) next= ;;
 
737
          esac
 
738
        fi
 
739
      done
 
740
      if test "X$rpathdirs" != "X"; then
 
741
        if test -n ""$3""; then
 
742
          dnl libtool is used for linking. Use -R options.
 
743
          for dir in $rpathdirs; do
 
744
            $1="${$1}${$1:+ }-R$dir"
 
745
          done
 
746
        else
 
747
          dnl The linker is used for linking directly.
 
748
          if test -n "$acl_hardcode_libdir_separator"; then
 
749
            dnl Weird platform: only the last -rpath option counts, the user
 
750
            dnl must pass all path elements in one option.
 
751
            alldirs=
 
752
            for dir in $rpathdirs; do
 
753
              alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
 
754
            done
 
755
            acl_save_libdir="$libdir"
 
756
            libdir="$alldirs"
 
757
            eval flag=\"$acl_hardcode_libdir_flag_spec\"
 
758
            libdir="$acl_save_libdir"
 
759
            $1="$flag"
 
760
          else
 
761
            dnl The -rpath options are cumulative.
 
762
            for dir in $rpathdirs; do
 
763
              acl_save_libdir="$libdir"
 
764
              libdir="$dir"
 
765
              eval flag=\"$acl_hardcode_libdir_flag_spec\"
 
766
              libdir="$acl_save_libdir"
 
767
              $1="${$1}${$1:+ }$flag"
 
768
            done
 
769
          fi
 
770
        fi
 
771
      fi
 
772
    fi
 
773
  fi
 
774
  AC_SUBST([$1])
 
775
])