~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to m4/lib-link.m4

  • Committer: Stewart Smith
  • Date: 2010-02-15 03:55:09 UTC
  • mto: (1273.13.96 build)
  • mto: This revision was merged to the branch mainline in revision 1308.
  • Revision ID: stewart@flamingspork.com-20100215035509-y6sry4q4yymph2by
move SUBSTR, SUBSTRING and SUBSTR_INDEX to plugins. add parser hooks for substr being a plugin now.

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
 
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
 
46
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [system])
47
47
dnl searches for libname and the libraries corresponding to explicit and
48
48
dnl implicit dependencies, together with the specified include files and
49
49
dnl the ability to compile and link the specified testcode. If found, it
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.
66
 
  AC_LIB_LINKFLAGS_BODY([$1], [$2])
 
66
  AC_LIB_LINKFLAGS_BODY([$1], [$2], [$5])
67
67
 
68
68
  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
69
69
  dnl because if the user has installed lib[]Name and not disabled its use
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]) searches for libname and
140
 
dnl the libraries corresponding to explicit and 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.
141
163
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
142
164
dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
143
165
dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
 
166
dnl If system==system, -isystem is used instead of -I
144
167
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
145
168
[
146
169
  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
147
 
  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
148
 
                               [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])])
149
176
  dnl Autoconf >= 2.61 supports dots in --with options.
150
 
  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)])
151
178
  dnl By default, look in $includedir and $libdir.
152
179
  use_additional=yes
 
180
  if test "x$GCC" = "xyes" -a "x$3" = "xsystem"
 
181
  then
 
182
    i_system="-isystem "
 
183
  else
 
184
    i_system="-I"
 
185
  fi
 
186
 
153
187
  AC_LIB_WITH_FINAL_PREFIX([
154
188
    eval additional_includedir=\"$includedir\"
155
189
    eval additional_libdir=\"$libdir\"
156
190
  ])
157
 
  AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix],
158
 
[  --with-lib]N_A_M_E[-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
159
 
  --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]],
160
194
[
161
195
    if test "X$withval" = "Xno"; then
162
196
      use_additional=no
169
203
      else
170
204
        additional_includedir="$withval/include"
171
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
172
210
      fi
173
211
    fi
174
212
])
327
365
              dnl Linking with a shared library. We attempt to hardcode its
328
366
              dnl directory into the executable's runpath, unless it's the
329
367
              dnl standard /usr/lib.
330
 
              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
331
371
                dnl No hardcoding is needed.
332
372
                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
333
373
              else
415
455
            case "$found_dir" in
416
456
              */$acl_libdirstem | */$acl_libdirstem/)
417
457
                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
418
 
                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
419
468
                additional_includedir="$basedir/include"
420
469
                ;;
421
470
            esac
439
488
                if test -z "$haveit"; then
440
489
                  for x in $CPPFLAGS $INC[]NAME; do
441
490
                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
442
 
                    if test "X$x" = "X-I$additional_includedir"; then
 
491
                    if test "X$x" = "X${i_system}$additional_includedir"; then
443
492
                      haveit=yes
444
493
                      break
445
494
                    fi
447
496
                  if test -z "$haveit"; then
448
497
                    if test -d "$additional_includedir"; then
449
498
                      dnl Really add $additional_includedir to $INCNAME.
450
 
                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
 
499
                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }${i_system}$additional_includedir"
451
500
                    fi
452
501
                  fi
453
502
                fi
476
525
                    dnl   3. if it's already present in $LDFLAGS or the already
477
526
                    dnl      constructed $LIBNAME,
478
527
                    dnl   4. if it doesn't exist as a directory.
479
 
                    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
480
530
                      haveit=
481
 
                      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
482
533
                        if test -n "$GCC"; then
483
534
                          case $host_os in
484
535
                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
609
660
      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
610
661
    done
611
662
  fi
 
663
  popdef([P_A_C_K])
 
664
  popdef([PACKLIBS])
 
665
  popdef([PACKUP])
 
666
  popdef([PACK])
 
667
  popdef([NAME])
612
668
])
613
669
 
614
670
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
654
710
        if test -n "$next"; then
655
711
          dir="$next"
656
712
          dnl No need to hardcode the standard /usr/lib.
657
 
          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
658
715
            rpathdirs="$rpathdirs $dir"
659
716
          fi
660
717
          next=
663
720
            -L) next=yes ;;
664
721
            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
665
722
                 dnl No need to hardcode the standard /usr/lib.
666
 
                 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
667
725
                   rpathdirs="$rpathdirs $dir"
668
726
                 fi
669
727
                 next= ;;