diff options
Diffstat (limited to 'gl/m4/lib-link.m4')
-rw-r--r-- | gl/m4/lib-link.m4 | 103 |
1 files changed, 76 insertions, 27 deletions
diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4 index e3d26fc4..fcd3391b 100644 --- a/gl/m4/lib-link.m4 +++ b/gl/m4/lib-link.m4 | |||
@@ -1,12 +1,12 @@ | |||
1 | # lib-link.m4 serial 13 (gettext-0.17) | 1 | # lib-link.m4 serial 18 (gettext-0.18) |
2 | dnl Copyright (C) 2001-2007 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
8 | 8 | ||
9 | AC_PREREQ(2.54) | 9 | AC_PREREQ([2.54]) |
10 | 10 | ||
11 | dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and | 11 | dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and |
12 | dnl the libraries corresponding to explicit and implicit dependencies. | 12 | dnl the libraries corresponding to explicit and implicit dependencies. |
@@ -18,9 +18,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS], | |||
18 | [ | 18 | [ |
19 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) | 19 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
20 | AC_REQUIRE([AC_LIB_RPATH]) | 20 | AC_REQUIRE([AC_LIB_RPATH]) |
21 | define([Name],[translit([$1],[./-], [___])]) | 21 | pushdef([Name],[translit([$1],[./-], [___])]) |
22 | define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], | 22 | pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], |
23 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | 23 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) |
24 | AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ | 24 | AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ |
25 | AC_LIB_LINKFLAGS_BODY([$1], [$2]) | 25 | AC_LIB_LINKFLAGS_BODY([$1], [$2]) |
26 | ac_cv_lib[]Name[]_libs="$LIB[]NAME" | 26 | ac_cv_lib[]Name[]_libs="$LIB[]NAME" |
@@ -39,8 +39,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS], | |||
39 | dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the | 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. | 40 | dnl results of this search when this library appears as a dependency. |
41 | HAVE_LIB[]NAME=yes | 41 | HAVE_LIB[]NAME=yes |
42 | undefine([Name]) | 42 | popdef([NAME]) |
43 | undefine([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) |
@@ -57,9 +57,9 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], | |||
57 | [ | 57 | [ |
58 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) | 58 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
59 | AC_REQUIRE([AC_LIB_RPATH]) | 59 | AC_REQUIRE([AC_LIB_RPATH]) |
60 | define([Name],[translit([$1],[./-], [___])]) | 60 | pushdef([Name],[translit([$1],[./-], [___])]) |
61 | define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], | 61 | pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], |
62 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | 62 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) |
63 | 63 | ||
64 | dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME | 64 | dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME |
65 | dnl accordingly. | 65 | dnl accordingly. |
@@ -95,8 +95,8 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], | |||
95 | AC_SUBST([LIB]NAME) | 95 | AC_SUBST([LIB]NAME) |
96 | AC_SUBST([LTLIB]NAME) | 96 | AC_SUBST([LTLIB]NAME) |
97 | AC_SUBST([LIB]NAME[_PREFIX]) | 97 | AC_SUBST([LIB]NAME[_PREFIX]) |
98 | undefine([Name]) | 98 | popdef([NAME]) |
99 | undefine([NAME]) | 99 | popdef([Name]) |
100 | ]) | 100 | ]) |
101 | 101 | ||
102 | dnl Determine the platform dependent parameters needed to use rpath: | 102 | dnl Determine the platform dependent parameters needed to use rpath: |
@@ -114,7 +114,7 @@ AC_DEFUN([AC_LIB_RPATH], | |||
114 | AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld | 114 | AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld |
115 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host | 115 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host |
116 | AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir | 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 | CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ | 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 | 119 | ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh |
120 | . ./conftest.sh | 120 | . ./conftest.sh |
@@ -131,11 +131,32 @@ AC_DEFUN([AC_LIB_RPATH], | |||
131 | acl_hardcode_direct="$acl_cv_hardcode_direct" | 131 | acl_hardcode_direct="$acl_cv_hardcode_direct" |
132 | acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" | 132 | acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" |
133 | dnl Determine whether the user wants rpath handling at all. | 133 | dnl Determine whether the user wants rpath handling at all. |
134 | AC_ARG_ENABLE(rpath, | 134 | AC_ARG_ENABLE([rpath], |
135 | [ --disable-rpath do not hardcode runtime library paths], | 135 | [ --disable-rpath do not hardcode runtime library paths], |
136 | :, enable_rpath=yes) | 136 | :, enable_rpath=yes) |
137 | ]) | 137 | ]) |
138 | 138 | ||
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 | |||
139 | dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and | 160 | dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and |
140 | dnl the libraries corresponding to explicit and implicit dependencies. | 161 | dnl the libraries corresponding to explicit and implicit dependencies. |
141 | dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. | 162 | dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. |
@@ -144,19 +165,23 @@ dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. | |||
144 | AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | 165 | AC_DEFUN([AC_LIB_LINKFLAGS_BODY], |
145 | [ | 166 | [ |
146 | AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) | 167 | AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) |
147 | define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], | 168 | pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], |
148 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | 169 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) |
170 | pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) | ||
171 | pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-], | ||
172 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | ||
173 | pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) | ||
149 | dnl Autoconf >= 2.61 supports dots in --with options. | 174 | 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])]) | 175 | pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)]) |
151 | dnl By default, look in $includedir and $libdir. | 176 | dnl By default, look in $includedir and $libdir. |
152 | use_additional=yes | 177 | use_additional=yes |
153 | AC_LIB_WITH_FINAL_PREFIX([ | 178 | AC_LIB_WITH_FINAL_PREFIX([ |
154 | eval additional_includedir=\"$includedir\" | 179 | eval additional_includedir=\"$includedir\" |
155 | eval additional_libdir=\"$libdir\" | 180 | eval additional_libdir=\"$libdir\" |
156 | ]) | 181 | ]) |
157 | AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix], | 182 | AC_ARG_WITH(P_A_C_K[-prefix], |
158 | [ --with-lib]N_A_M_E[-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib | 183 | [[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib |
159 | --without-lib]N_A_M_E[-prefix don't search for lib$1 in includedir and libdir], | 184 | --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], |
160 | [ | 185 | [ |
161 | if test "X$withval" = "Xno"; then | 186 | if test "X$withval" = "Xno"; then |
162 | use_additional=no | 187 | use_additional=no |
@@ -169,6 +194,10 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
169 | else | 194 | else |
170 | additional_includedir="$withval/include" | 195 | additional_includedir="$withval/include" |
171 | additional_libdir="$withval/$acl_libdirstem" | 196 | additional_libdir="$withval/$acl_libdirstem" |
197 | if test "$acl_libdirstem2" != "$acl_libdirstem" \ | ||
198 | && ! test -d "$withval/$acl_libdirstem"; then | ||
199 | additional_libdir="$withval/$acl_libdirstem2" | ||
200 | fi | ||
172 | fi | 201 | fi |
173 | fi | 202 | fi |
174 | ]) | 203 | ]) |
@@ -327,7 +356,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
327 | dnl Linking with a shared library. We attempt to hardcode its | 356 | dnl Linking with a shared library. We attempt to hardcode its |
328 | dnl directory into the executable's runpath, unless it's the | 357 | dnl directory into the executable's runpath, unless it's the |
329 | dnl standard /usr/lib. | 358 | dnl standard /usr/lib. |
330 | if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then | 359 | if test "$enable_rpath" = no \ |
360 | || test "X$found_dir" = "X/usr/$acl_libdirstem" \ | ||
361 | || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then | ||
331 | dnl No hardcoding is needed. | 362 | dnl No hardcoding is needed. |
332 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" | 363 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" |
333 | else | 364 | else |
@@ -415,7 +446,16 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
415 | case "$found_dir" in | 446 | case "$found_dir" in |
416 | */$acl_libdirstem | */$acl_libdirstem/) | 447 | */$acl_libdirstem | */$acl_libdirstem/) |
417 | basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` | 448 | basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` |
418 | LIB[]NAME[]_PREFIX="$basedir" | 449 | if test "$name" = '$1'; then |
450 | LIB[]NAME[]_PREFIX="$basedir" | ||
451 | fi | ||
452 | additional_includedir="$basedir/include" | ||
453 | ;; | ||
454 | */$acl_libdirstem2 | */$acl_libdirstem2/) | ||
455 | basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` | ||
456 | if test "$name" = '$1'; then | ||
457 | LIB[]NAME[]_PREFIX="$basedir" | ||
458 | fi | ||
419 | additional_includedir="$basedir/include" | 459 | additional_includedir="$basedir/include" |
420 | ;; | 460 | ;; |
421 | esac | 461 | esac |
@@ -476,9 +516,11 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
476 | dnl 3. if it's already present in $LDFLAGS or the already | 516 | dnl 3. if it's already present in $LDFLAGS or the already |
477 | dnl constructed $LIBNAME, | 517 | dnl constructed $LIBNAME, |
478 | dnl 4. if it doesn't exist as a directory. | 518 | dnl 4. if it doesn't exist as a directory. |
479 | if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then | 519 | if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ |
520 | && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then | ||
480 | haveit= | 521 | haveit= |
481 | if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then | 522 | if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ |
523 | || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then | ||
482 | if test -n "$GCC"; then | 524 | if test -n "$GCC"; then |
483 | case $host_os in | 525 | case $host_os in |
484 | linux* | gnu* | k*bsd*-gnu) haveit=yes;; | 526 | linux* | gnu* | k*bsd*-gnu) haveit=yes;; |
@@ -609,6 +651,11 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
609 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" | 651 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" |
610 | done | 652 | done |
611 | fi | 653 | fi |
654 | popdef([P_A_C_K]) | ||
655 | popdef([PACKLIBS]) | ||
656 | popdef([PACKUP]) | ||
657 | popdef([PACK]) | ||
658 | popdef([NAME]) | ||
612 | ]) | 659 | ]) |
613 | 660 | ||
614 | dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, | 661 | dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, |
@@ -654,7 +701,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], | |||
654 | if test -n "$next"; then | 701 | if test -n "$next"; then |
655 | dir="$next" | 702 | dir="$next" |
656 | dnl No need to hardcode the standard /usr/lib. | 703 | dnl No need to hardcode the standard /usr/lib. |
657 | if test "X$dir" != "X/usr/$acl_libdirstem"; then | 704 | if test "X$dir" != "X/usr/$acl_libdirstem" \ |
705 | && test "X$dir" != "X/usr/$acl_libdirstem2"; then | ||
658 | rpathdirs="$rpathdirs $dir" | 706 | rpathdirs="$rpathdirs $dir" |
659 | fi | 707 | fi |
660 | next= | 708 | next= |
@@ -663,7 +711,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], | |||
663 | -L) next=yes ;; | 711 | -L) next=yes ;; |
664 | -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` | 712 | -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` |
665 | dnl No need to hardcode the standard /usr/lib. | 713 | dnl No need to hardcode the standard /usr/lib. |
666 | if test "X$dir" != "X/usr/$acl_libdirstem"; then | 714 | if test "X$dir" != "X/usr/$acl_libdirstem" \ |
715 | && test "X$dir" != "X/usr/$acl_libdirstem2"; then | ||
667 | rpathdirs="$rpathdirs $dir" | 716 | rpathdirs="$rpathdirs $dir" |
668 | fi | 717 | fi |
669 | next= ;; | 718 | next= ;; |