~drizzle-trunk/drizzle/development

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