Mercurial > gnulib
annotate m4/lib-prefix.m4 @ 40196:e63f5d3edab5
relocatable-prog: Update documentation.
* doc/relocatable-maint.texi (Supporting Relocation): Update to match
the recent changes.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 24 Feb 2019 01:49:15 +0100 |
parents | b06060465f09 |
children |
rev | line source |
---|---|
39965
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
1 # lib-prefix.m4 serial 14 |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
39965
diff
changeset
|
2 dnl Copyright (C) 2001-2005, 2008-2019 Free Software Foundation, Inc. |
5585
adff74659d81
Use an all-permissive copyright notice, recommended by RMS.
Bruno Haible <bruno@clisp.org>
parents:
4897
diff
changeset
|
3 dnl This file is free software; the Free Software Foundation |
adff74659d81
Use an all-permissive copyright notice, recommended by RMS.
Bruno Haible <bruno@clisp.org>
parents:
4897
diff
changeset
|
4 dnl gives unlimited permission to copy and/or distribute it, |
adff74659d81
Use an all-permissive copyright notice, recommended by RMS.
Bruno Haible <bruno@clisp.org>
parents:
4897
diff
changeset
|
5 dnl with or without modifications, as long as this notice is preserved. |
3748 | 6 |
7 dnl From Bruno Haible. | |
8 | |
9 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed | |
10 dnl to access previously installed libraries. The basic assumption is that | |
11 dnl a user will want packages to use other packages he previously installed | |
12 dnl with the same --prefix option. | |
13 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate | |
14 dnl libraries, but is otherwise very convenient. | |
15 AC_DEFUN([AC_LIB_PREFIX], | |
16 [ | |
17 AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) | |
18 AC_REQUIRE([AC_PROG_CC]) | |
19 AC_REQUIRE([AC_CANONICAL_HOST]) | |
6200
dae7c9179bef
Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents:
5659
diff
changeset
|
20 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) |
3748 | 21 AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
22 dnl By default, look in $includedir and $libdir. | |
23 use_additional=yes | |
24 AC_LIB_WITH_FINAL_PREFIX([ | |
25 eval additional_includedir=\"$includedir\" | |
26 eval additional_libdir=\"$libdir\" | |
27 ]) | |
39944 | 28 AC_ARG_WITH([lib-prefix], |
29 [[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib | |
30 --without-lib-prefix don't search for libraries in includedir and libdir]], | |
3748 | 31 [ |
32 if test "X$withval" = "Xno"; then | |
33 use_additional=no | |
34 else | |
35 if test "X$withval" = "X"; then | |
4536
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
36 AC_LIB_WITH_FINAL_PREFIX([ |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
37 eval additional_includedir=\"$includedir\" |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
38 eval additional_libdir=\"$libdir\" |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
39 ]) |
3748 | 40 else |
4536
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
41 additional_includedir="$withval/include" |
6200
dae7c9179bef
Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents:
5659
diff
changeset
|
42 additional_libdir="$withval/$acl_libdirstem" |
3748 | 43 fi |
44 fi | |
45 ]) | |
46 if test $use_additional = yes; then | |
47 dnl Potentially add $additional_includedir to $CPPFLAGS. | |
48 dnl But don't add it | |
49 dnl 1. if it's the standard /usr/include, | |
50 dnl 2. if it's already present in $CPPFLAGS, | |
51 dnl 3. if it's /usr/local/include and we are using GCC on Linux, | |
52 dnl 4. if it doesn't exist as a directory. | |
53 if test "X$additional_includedir" != "X/usr/include"; then | |
54 haveit= | |
55 for x in $CPPFLAGS; do | |
4536
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
56 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
57 if test "X$x" = "X-I$additional_includedir"; then |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
58 haveit=yes |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
59 break |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
60 fi |
3748 | 61 done |
62 if test -z "$haveit"; then | |
4536
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
63 if test "X$additional_includedir" = "X/usr/local/include"; then |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
64 if test -n "$GCC"; then |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
65 case $host_os in |
5659
be44f23226e0
Update from GNU gettext 0.14.2.
Bruno Haible <bruno@clisp.org>
parents:
5585
diff
changeset
|
66 linux* | gnu* | k*bsd*-gnu) haveit=yes;; |
4536
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
67 esac |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
68 fi |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
69 fi |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
70 if test -z "$haveit"; then |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
71 if test -d "$additional_includedir"; then |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
72 dnl Really add $additional_includedir to $CPPFLAGS. |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
73 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
74 fi |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
75 fi |
3748 | 76 fi |
77 fi | |
78 dnl Potentially add $additional_libdir to $LDFLAGS. | |
79 dnl But don't add it | |
80 dnl 1. if it's the standard /usr/lib, | |
81 dnl 2. if it's already present in $LDFLAGS, | |
82 dnl 3. if it's /usr/local/lib and we are using GCC on Linux, | |
83 dnl 4. if it doesn't exist as a directory. | |
6200
dae7c9179bef
Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents:
5659
diff
changeset
|
84 if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then |
3748 | 85 haveit= |
86 for x in $LDFLAGS; do | |
4536
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
87 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
88 if test "X$x" = "X-L$additional_libdir"; then |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
89 haveit=yes |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
90 break |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
91 fi |
3748 | 92 done |
93 if test -z "$haveit"; then | |
6200
dae7c9179bef
Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents:
5659
diff
changeset
|
94 if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then |
4536
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
95 if test -n "$GCC"; then |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
96 case $host_os in |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
97 linux*) haveit=yes;; |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
98 esac |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
99 fi |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
100 fi |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
101 if test -z "$haveit"; then |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
102 if test -d "$additional_libdir"; then |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
103 dnl Really add $additional_libdir to $LDFLAGS. |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
104 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
105 fi |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
106 fi |
3748 | 107 fi |
108 fi | |
109 fi | |
110 ]) | |
111 | |
112 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, | |
113 dnl acl_final_exec_prefix, containing the values to which $prefix and | |
114 dnl $exec_prefix will expand at the end of the configure script. | |
115 AC_DEFUN([AC_LIB_PREPARE_PREFIX], | |
116 [ | |
117 dnl Unfortunately, prefix and exec_prefix get only finally determined | |
118 dnl at the end of configure. | |
119 if test "X$prefix" = "XNONE"; then | |
120 acl_final_prefix="$ac_default_prefix" | |
121 else | |
122 acl_final_prefix="$prefix" | |
123 fi | |
124 if test "X$exec_prefix" = "XNONE"; then | |
125 acl_final_exec_prefix='${prefix}' | |
126 else | |
127 acl_final_exec_prefix="$exec_prefix" | |
128 fi | |
129 acl_save_prefix="$prefix" | |
130 prefix="$acl_final_prefix" | |
131 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" | |
132 prefix="$acl_save_prefix" | |
133 ]) | |
134 | |
135 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the | |
136 dnl variables prefix and exec_prefix bound to the values they will have | |
137 dnl at the end of the configure script. | |
138 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], | |
139 [ | |
140 acl_save_prefix="$prefix" | |
141 prefix="$acl_final_prefix" | |
142 acl_save_exec_prefix="$exec_prefix" | |
143 exec_prefix="$acl_final_exec_prefix" | |
144 $1 | |
145 exec_prefix="$acl_save_exec_prefix" | |
146 prefix="$acl_save_prefix" | |
147 ]) | |
6200
dae7c9179bef
Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents:
5659
diff
changeset
|
148 |
10386
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
149 dnl AC_LIB_PREPARE_MULTILIB creates |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
150 dnl - a variable acl_libdirstem, containing the basename of the libdir, either |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
151 dnl "lib" or "lib64" or "lib/64", |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
152 dnl - a variable acl_libdirstem2, as a secondary possible value for |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
153 dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
154 dnl "lib/amd64". |
6200
dae7c9179bef
Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents:
5659
diff
changeset
|
155 AC_DEFUN([AC_LIB_PREPARE_MULTILIB], |
dae7c9179bef
Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents:
5659
diff
changeset
|
156 [ |
10386
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
157 dnl There is no formal standard regarding lib and lib64. |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
158 dnl On glibc systems, the current practice is that on a system supporting |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
159 dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
160 dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
161 dnl the compiler's default mode by looking at the compiler's library search |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
162 dnl path. If at least one of its elements ends in /lib64 or points to a |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
163 dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
164 dnl Otherwise we use the default, namely "lib". |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
165 dnl On Solaris systems, the current practice is that on a system supporting |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
166 dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
167 dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
168 dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. |
67cf8265aeed
Assume Solaris specific bi-arch conventions on Solaris systems.
Bruno Haible <bruno@clisp.org>
parents:
6200
diff
changeset
|
169 AC_REQUIRE([AC_CANONICAL_HOST]) |
39965
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
170 AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT]) |
39951
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
171 |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
172 case "$host_os" in |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
173 solaris*) |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
174 AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
175 [AC_COMPILE_IFELSE( |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
176 [AC_LANG_SOURCE( |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
177 [[#ifdef _LP64 |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
178 int ok; |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
179 #else |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
180 error fail |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
181 #endif |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
182 ]])], |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
183 [gl_cv_solaris_64bit=yes], |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
184 [gl_cv_solaris_64bit=no]) |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
185 ]);; |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
186 esac |
b460856f7515
havelib: fix nested ‘configure’ chatter
Paul Eggert <eggert@cs.ucla.edu>
parents:
39944
diff
changeset
|
187 |
18705
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
188 dnl Allow the user to override the result by setting acl_cv_libdirstems. |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
189 AC_CACHE_CHECK([for the common suffixes of directories in the library search path], |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
190 [acl_cv_libdirstems], |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
191 [acl_libdirstem=lib |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
192 acl_libdirstem2= |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
193 case "$host_os" in |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
194 solaris*) |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
195 dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment |
19192
d86e08b1f555
all: Replace many more http URLs by https URLs. Update stale URLs.
Bruno Haible <bruno@clisp.org>
parents:
18706
diff
changeset
|
196 dnl <https://docs.oracle.com/cd/E19253-01/816-5138/dev-env/index.html>. |
18705
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
197 dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
198 dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
199 dnl symlink is missing, so we set acl_libdirstem2 too. |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
200 if test $gl_cv_solaris_64bit = yes; then |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
201 acl_libdirstem=lib/64 |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
202 case "$host_cpu" in |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
203 sparc*) acl_libdirstem2=lib/sparcv9 ;; |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
204 i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
205 esac |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
206 fi |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
207 ;; |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
208 *) |
19219
037ac9ebd80a
havelib: Make it work for CC="gcc -m32" (regression from 2017-02-19).
Bruno Haible <bruno@clisp.org>
parents:
19192
diff
changeset
|
209 dnl If $CC generates code for a 32-bit ABI, the libraries are |
037ac9ebd80a
havelib: Make it work for CC="gcc -m32" (regression from 2017-02-19).
Bruno Haible <bruno@clisp.org>
parents:
19192
diff
changeset
|
210 dnl surely under $prefix/lib, not $prefix/lib64. |
39965
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
211 if test "$HOST_CPU_C_ABI_32BIT" != yes; then |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
212 dnl The result is a property of the system. However, non-system |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
213 dnl compilers sometimes have odd library search paths. Therefore |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
214 dnl prefer asking /usr/bin/gcc, if available, rather than $CC. |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
215 searchpath=`(if test -f /usr/bin/gcc \ |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
216 && LC_ALL=C /usr/bin/gcc -print-search-dirs >/dev/null 2>/dev/null; then \ |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
217 LC_ALL=C /usr/bin/gcc -print-search-dirs; \ |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
218 else \ |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
219 LC_ALL=C $CC -print-search-dirs; \ |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
220 fi) 2>/dev/null \ |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
221 | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
222 if test -n "$searchpath"; then |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
223 acl_save_IFS="${IFS= }"; IFS=":" |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
224 for searchdir in $searchpath; do |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
225 if test -d "$searchdir"; then |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
226 case "$searchdir" in |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
227 */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
228 */../ | */.. ) |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
229 # Better ignore directories of this form. They are misleading. |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
230 ;; |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
231 *) searchdir=`cd "$searchdir" && pwd` |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
232 case "$searchdir" in |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
233 */lib64 ) acl_libdirstem=lib64 ;; |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
234 esac ;; |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
235 esac |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
236 fi |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
237 done |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
238 IFS="$acl_save_IFS" |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
239 fi |
3192a132a924
havelib: Remove the need to include asm-underscore.m4.
Bruno Haible <bruno@clisp.org>
parents:
39951
diff
changeset
|
240 fi |
18705
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
241 ;; |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
242 esac |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
243 test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
244 acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2" |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
245 ]) |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
246 # Decompose acl_cv_libdirstems into acl_libdirstem and acl_libdirstem2. |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
247 acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` |
a54a3e501f5b
havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
Bruno Haible <bruno@clisp.org>
parents:
18626
diff
changeset
|
248 acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e '/,/s/.*,//'` |
6200
dae7c9179bef
Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents:
5659
diff
changeset
|
249 ]) |