~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to m4/lib-link.m4

  • Committer: Monty Taylor
  • Date: 2009-06-30 18:09:07 UTC
  • mto: This revision was merged to the branch mainline in revision 1083.
  • Revision ID: mordred@inaugust.com-20090630180907-r24363hlhgxg4cbw
Whole boat-load of build fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# lib-link.m4 serial 13 (gettext-0.17)
2
 
dnl Copyright (C) 2001-2007 Free Software Foundation, Inc.
 
1
# lib-link.m4 serial 18 (gettext-0.18)
 
2
dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
6
6
 
7
7
dnl From Bruno Haible.
8
8
 
9
 
AC_PREREQ(2.54)
 
9
AC_PREREQ([2.54])
10
10
 
11
11
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
12
12
dnl the libraries corresponding to explicit and implicit dependencies.
18
18
[
19
19
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
20
20
  AC_REQUIRE([AC_LIB_RPATH])
21
 
  define([Name],[translit([$1],[./-], [___])])
22
 
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
23
 
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
 
21
  pushdef([Name],[translit([$1],[./-], [___])])
 
22
  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
 
23
                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
24
24
  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
25
25
    AC_LIB_LINKFLAGS_BODY([$1], [$2])
26
26
    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
39
39
  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
40
40
  dnl results of this search when this library appears as a dependency.
41
41
  HAVE_LIB[]NAME=yes
42
 
  undefine([Name])
43
 
  undefine([NAME])
 
42
  popdef([NAME])
 
43
  popdef([Name])
44
44
])
45
45
 
46
46
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [system])
57
57
[
58
58
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
59
59
  AC_REQUIRE([AC_LIB_RPATH])
60
 
  define([Name],[translit([$1],[./-], [___])])
61
 
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
62
 
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
 
60
  pushdef([Name],[translit([$1],[./-], [___])])
 
61
  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
 
62
                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
63
63
 
64
64
  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
65
65
  dnl accordingly.
95
95
  AC_SUBST([LIB]NAME)
96
96
  AC_SUBST([LTLIB]NAME)
97
97
  AC_SUBST([LIB]NAME[_PREFIX])
98
 
  undefine([Name])
99
 
  undefine([NAME])
 
98
  popdef([NAME])
 
99
  popdef([Name])
100
100
])
101
101
 
102
102
dnl Determine the platform dependent parameters needed to use rpath:
114
114
  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
115
115
  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
116
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, [
 
117
  AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
118
118
    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
119
119
    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
120
120
    . ./conftest.sh
131
131
  acl_hardcode_direct="$acl_cv_hardcode_direct"
132
132
  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
133
133
  dnl Determine whether the user wants rpath handling at all.
134
 
  AC_ARG_ENABLE(rpath,
 
134
  AC_ARG_ENABLE([rpath],
135
135
    [  --disable-rpath         do not hardcode runtime library paths],
136
136
    :, enable_rpath=yes)
137
137
])
138
138
 
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.
 
139
dnl AC_LIB_FROMPACKAGE(name, package)
 
140
dnl declares that libname comes from the given package. The configure file
 
141
dnl will then not have a --with-libname-prefix option but a
 
142
dnl --with-package-prefix option. Several libraries can come from the same
 
143
dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
 
144
dnl macro call that searches for libname.
 
145
AC_DEFUN([AC_LIB_FROMPACKAGE],
 
146
[
 
147
  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
 
148
                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
 
149
  define([acl_frompackage_]NAME, [$2])
 
150
  popdef([NAME])
 
151
  pushdef([PACK],[$2])
 
152
  pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
 
153
                                  [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
 
154
  define([acl_libsinpackage_]PACKUP,
 
155
    m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1])
 
156
  popdef([PACKUP])
 
157
  popdef([PACK])
 
158
])
 
159
 
 
160
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies, system]) searches for
 
161
dnl libname and the libraries corresponding to explicit and implicit
 
162
dnl dependencies.
142
163
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
143
164
dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
144
165
dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
146
167
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
147
168
[
148
169
  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
149
 
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
150
 
                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
 
170
  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
 
171
                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
 
172
  pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
 
173
  pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
 
174
                                  [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
 
175
  pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
151
176
  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])])
 
177
  pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)])
153
178
  dnl By default, look in $includedir and $libdir.
154
179
  use_additional=yes
155
180
  if test "x$GCC" = "xyes" -a "x$3" = "xsystem"
158
183
  else
159
184
    i_system="-I"
160
185
  fi
 
186
 
161
187
  AC_LIB_WITH_FINAL_PREFIX([
162
188
    eval additional_includedir=\"$includedir\"
163
189
    eval additional_libdir=\"$libdir\"
164
190
  ])
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],
 
191
  AC_ARG_WITH(P_A_C_K[-prefix],
 
192
[[  --with-]]P_A_C_K[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and DIR/lib
 
193
  --without-]]P_A_C_K[[-prefix     don't search for ]PACKLIBS[ in includedir and libdir]],
168
194
[
169
195
    if test "X$withval" = "Xno"; then
170
196
      use_additional=no
177
203
      else
178
204
        additional_includedir="$withval/include"
179
205
        additional_libdir="$withval/$acl_libdirstem"
 
206
        if test "$acl_libdirstem2" != "$acl_libdirstem" \
 
207
           && ! test -d "$withval/$acl_libdirstem"; then
 
208
          additional_libdir="$withval/$acl_libdirstem2"
 
209
        fi
180
210
      fi
181
211
    fi
182
212
])
335
365
              dnl Linking with a shared library. We attempt to hardcode its
336
366
              dnl directory into the executable's runpath, unless it's the
337
367
              dnl standard /usr/lib.
338
 
              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
 
368
              if test "$enable_rpath" = no \
 
369
                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
 
370
                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
339
371
                dnl No hardcoding is needed.
340
372
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
341
373
              else
423
455
            case "$found_dir" in
424
456
              */$acl_libdirstem | */$acl_libdirstem/)
425
457
                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
426
 
                LIB[]NAME[]_PREFIX="$basedir"
 
458
                if test "$name" = '$1'; then
 
459
                  LIB[]NAME[]_PREFIX="$basedir"
 
460
                fi
 
461
                additional_includedir="$basedir/include"
 
462
                ;;
 
463
              */$acl_libdirstem2 | */$acl_libdirstem2/)
 
464
                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
 
465
                if test "$name" = '$1'; then
 
466
                  LIB[]NAME[]_PREFIX="$basedir"
 
467
                fi
427
468
                additional_includedir="$basedir/include"
428
469
                ;;
429
470
            esac
484
525
                    dnl   3. if it's already present in $LDFLAGS or the already
485
526
                    dnl      constructed $LIBNAME,
486
527
                    dnl   4. if it doesn't exist as a directory.
487
 
                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
 
528
                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
 
529
                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
488
530
                      haveit=
489
 
                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
 
531
                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
 
532
                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
490
533
                        if test -n "$GCC"; then
491
534
                          case $host_os in
492
535
                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
617
660
      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
618
661
    done
619
662
  fi
 
663
  popdef([P_A_C_K])
 
664
  popdef([PACKLIBS])
 
665
  popdef([PACKUP])
 
666
  popdef([PACK])
 
667
  popdef([NAME])
620
668
])
621
669
 
622
670
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
662
710
        if test -n "$next"; then
663
711
          dir="$next"
664
712
          dnl No need to hardcode the standard /usr/lib.
665
 
          if test "X$dir" != "X/usr/$acl_libdirstem"; then
 
713
          if test "X$dir" != "X/usr/$acl_libdirstem" \
 
714
             && test "X$dir" != "X/usr/$acl_libdirstem2"; then
666
715
            rpathdirs="$rpathdirs $dir"
667
716
          fi
668
717
          next=
671
720
            -L) next=yes ;;
672
721
            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
673
722
                 dnl No need to hardcode the standard /usr/lib.
674
 
                 if test "X$dir" != "X/usr/$acl_libdirstem"; then
 
723
                 if test "X$dir" != "X/usr/$acl_libdirstem" \
 
724
                    && test "X$dir" != "X/usr/$acl_libdirstem2"; then
675
725
                   rpathdirs="$rpathdirs $dir"
676
726
                 fi
677
727
                 next= ;;