~noskcaj/ubuntu/trusty/libextractor/merge

« back to all changes in this revision

Viewing changes to m4/lib-link.m4

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2008-11-08 02:05:01 UTC
  • mfrom: (1.10.2 upstream) (5.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20081108020501-ky32z9x7hk26po32
Tags: 0.5.20c-1ubuntu1
* Merge from Debian unstable, remaining Ubuntu changes:
  - (Build-)depend on libltdl7-dev (Ubuntu-specific change).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# lib-link.m4 serial 4 (gettext-0.12)
2
 
dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
3
 
dnl This file is free software, distributed under the terms of the GNU
4
 
dnl General Public License.  As a special exception to the GNU General
5
 
dnl Public License, this file may be distributed as part of a program
6
 
dnl that contains a configuration script generated by Autoconf, under
7
 
dnl the same distribution terms as the rest of that program.
 
1
# lib-link.m4 serial 9 (gettext-0.16)
 
2
dnl Copyright (C) 2001-2006 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.
8
6
 
9
7
dnl From Bruno Haible.
10
8
 
 
9
AC_PREREQ(2.50)
 
10
 
11
11
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
12
12
dnl the libraries corresponding to explicit and implicit dependencies.
13
13
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
95
95
dnl hardcode_direct, hardcode_minus_L.
96
96
AC_DEFUN([AC_LIB_RPATH],
97
97
[
 
98
  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
 
99
  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
98
100
  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
99
101
  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
100
102
  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
124
126
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
125
127
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
126
128
[
 
129
  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
127
130
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
128
131
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
129
132
  dnl By default, look in $includedir and $libdir.
146
149
        ])
147
150
      else
148
151
        additional_includedir="$withval/include"
149
 
        additional_libdir="$withval/lib"
 
152
        additional_libdir="$withval/$acl_libdirstem"
150
153
      fi
151
154
    fi
152
155
])
195
198
          found_so=
196
199
          found_a=
197
200
          if test $use_additional = yes; then
198
 
            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
 
201
            if test -n "$shlibext" \
 
202
               && { test -f "$additional_libdir/lib$name.$shlibext" \
 
203
                    || { test "$shlibext" = dll \
 
204
                         && test -f "$additional_libdir/lib$name.dll.a"; }; }; then
199
205
              found_dir="$additional_libdir"
200
 
              found_so="$additional_libdir/lib$name.$shlibext"
 
206
              if test -f "$additional_libdir/lib$name.$shlibext"; then
 
207
                found_so="$additional_libdir/lib$name.$shlibext"
 
208
              else
 
209
                found_so="$additional_libdir/lib$name.dll.a"
 
210
              fi
201
211
              if test -f "$additional_libdir/lib$name.la"; then
202
212
                found_la="$additional_libdir/lib$name.la"
203
213
              fi
217
227
              case "$x" in
218
228
                -L*)
219
229
                  dir=`echo "X$x" | sed -e 's/^X-L//'`
220
 
                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
 
230
                  if test -n "$shlibext" \
 
231
                     && { test -f "$dir/lib$name.$shlibext" \
 
232
                          || { test "$shlibext" = dll \
 
233
                               && test -f "$dir/lib$name.dll.a"; }; }; then
221
234
                    found_dir="$dir"
222
 
                    found_so="$dir/lib$name.$shlibext"
 
235
                    if test -f "$dir/lib$name.$shlibext"; then
 
236
                      found_so="$dir/lib$name.$shlibext"
 
237
                    else
 
238
                      found_so="$dir/lib$name.dll.a"
 
239
                    fi
223
240
                    if test -f "$dir/lib$name.la"; then
224
241
                      found_la="$dir/lib$name.la"
225
242
                    fi
246
263
              dnl Linking with a shared library. We attempt to hardcode its
247
264
              dnl directory into the executable's runpath, unless it's the
248
265
              dnl standard /usr/lib.
249
 
              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
 
266
              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
250
267
                dnl No hardcoding is needed.
251
268
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
252
269
              else
332
349
            dnl Assume the include files are nearby.
333
350
            additional_includedir=
334
351
            case "$found_dir" in
335
 
              */lib | */lib/)
336
 
                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
 
352
              */$acl_libdirstem | */$acl_libdirstem/)
 
353
                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
337
354
                additional_includedir="$basedir/include"
338
355
                ;;
339
356
            esac
350
367
                if test "X$additional_includedir" = "X/usr/local/include"; then
351
368
                  if test -n "$GCC"; then
352
369
                    case $host_os in
353
 
                      linux*) haveit=yes;;
 
370
                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
354
371
                    esac
355
372
                  fi
356
373
                fi
394
411
                    dnl   3. if it's already present in $LDFLAGS or the already
395
412
                    dnl      constructed $LIBNAME,
396
413
                    dnl   4. if it doesn't exist as a directory.
397
 
                    if test "X$additional_libdir" != "X/usr/lib"; then
 
414
                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
398
415
                      haveit=
399
 
                      if test "X$additional_libdir" = "X/usr/local/lib"; then
 
416
                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
400
417
                        if test -n "$GCC"; then
401
418
                          case $host_os in
402
 
                            linux*) haveit=yes;;
 
419
                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
403
420
                          esac
404
421
                        fi
405
422
                      fi
549
566
    fi
550
567
  done
551
568
])
 
569
 
 
570
dnl For those cases where a variable contains several -L and -l options
 
571
dnl referring to unknown libraries and directories, this macro determines the
 
572
dnl necessary additional linker options for the runtime path.
 
573
dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
 
574
dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
 
575
dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
 
576
dnl otherwise linking without libtool is assumed.
 
577
AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
 
578
[
 
579
  AC_REQUIRE([AC_LIB_RPATH])
 
580
  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
 
581
  $1=
 
582
  if test "$enable_rpath" != no; then
 
583
    if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
 
584
      dnl Use an explicit option to hardcode directories into the resulting
 
585
      dnl binary.
 
586
      rpathdirs=
 
587
      next=
 
588
      for opt in $2; do
 
589
        if test -n "$next"; then
 
590
          dir="$next"
 
591
          dnl No need to hardcode the standard /usr/lib.
 
592
          if test "X$dir" != "X/usr/$acl_libdirstem"; then
 
593
            rpathdirs="$rpathdirs $dir"
 
594
          fi
 
595
          next=
 
596
        else
 
597
          case $opt in
 
598
            -L) next=yes ;;
 
599
            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
 
600
                 dnl No need to hardcode the standard /usr/lib.
 
601
                 if test "X$dir" != "X/usr/$acl_libdirstem"; then
 
602
                   rpathdirs="$rpathdirs $dir"
 
603
                 fi
 
604
                 next= ;;
 
605
            *) next= ;;
 
606
          esac
 
607
        fi
 
608
      done
 
609
      if test "X$rpathdirs" != "X"; then
 
610
        if test -n ""$3""; then
 
611
          dnl libtool is used for linking. Use -R options.
 
612
          for dir in $rpathdirs; do
 
613
            $1="${$1}${$1:+ }-R$dir"
 
614
          done
 
615
        else
 
616
          dnl The linker is used for linking directly.
 
617
          if test -n "$hardcode_libdir_separator"; then
 
618
            dnl Weird platform: only the last -rpath option counts, the user
 
619
            dnl must pass all path elements in one option.
 
620
            alldirs=
 
621
            for dir in $rpathdirs; do
 
622
              alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$dir"
 
623
            done
 
624
            acl_save_libdir="$libdir"
 
625
            libdir="$alldirs"
 
626
            eval flag=\"$hardcode_libdir_flag_spec\"
 
627
            libdir="$acl_save_libdir"
 
628
            $1="$flag"
 
629
          else
 
630
            dnl The -rpath options are cumulative.
 
631
            for dir in $rpathdirs; do
 
632
              acl_save_libdir="$libdir"
 
633
              libdir="$dir"
 
634
              eval flag=\"$hardcode_libdir_flag_spec\"
 
635
              libdir="$acl_save_libdir"
 
636
              $1="${$1}${$1:+ }$flag"
 
637
            done
 
638
          fi
 
639
        fi
 
640
      fi
 
641
    fi
 
642
  fi
 
643
  AC_SUBST([$1])
 
644
])