annotate m4/lib-prefix.m4 @ 9600:99268e709d31

Avoid quadratic strstr implementations. * lib/strstr.c: New file. * m4/strstr.m4: Likewise. * modules/strstr: Likewise. * modules/strstr-tests: Likewise. * tests/test-strstr.c: Likewise. * lib/string.in.h (rpl_strstr): Declare. (memmem) [GNULIB_POSIXCHECK]: Document speed issue. * m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Support strstr. * modules/string (Makefile.am): Likewise. * MODULES.html.sh (string handling): Mention new module. * doc/functions/strstr.texi (strstr): Document the bug. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Thu, 10 Jan 2008 07:38:11 -0700
parents dae7c9179bef
children 67cf8265aeed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6200
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
1 # lib-prefix.m4 serial 5 (gettext-0.15)
5659
be44f23226e0 Update from GNU gettext 0.14.2.
Bruno Haible <bruno@clisp.org>
parents: 5585
diff changeset
2 dnl Copyright (C) 2001-2005 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
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
6
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
7 dnl From Bruno Haible.
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
8
4528
ae85e65ee361 Get m4 files from the gettext distribution.
Paul Eggert <eggert@cs.ucla.edu>
parents: 3748
diff changeset
9 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
ae85e65ee361 Get m4 files from the gettext distribution.
Paul Eggert <eggert@cs.ucla.edu>
parents: 3748
diff changeset
10 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
ae85e65ee361 Get m4 files from the gettext distribution.
Paul Eggert <eggert@cs.ucla.edu>
parents: 3748
diff changeset
11 dnl require excessive bracketing.
ae85e65ee361 Get m4 files from the gettext distribution.
Paul Eggert <eggert@cs.ucla.edu>
parents: 3748
diff changeset
12 ifdef([AC_HELP_STRING],
ae85e65ee361 Get m4 files from the gettext distribution.
Paul Eggert <eggert@cs.ucla.edu>
parents: 3748
diff changeset
13 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
4897
c784af02fcd9 updates from savannah outage
uid65818 <uid65818>
parents: 4536
diff changeset
14 [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
4528
ae85e65ee361 Get m4 files from the gettext distribution.
Paul Eggert <eggert@cs.ucla.edu>
parents: 3748
diff changeset
15
3748
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
16 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
17 dnl to access previously installed libraries. The basic assumption is that
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
18 dnl a user will want packages to use other packages he previously installed
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
19 dnl with the same --prefix option.
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
20 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
21 dnl libraries, but is otherwise very convenient.
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
22 AC_DEFUN([AC_LIB_PREFIX],
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
23 [
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
24 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
25 AC_REQUIRE([AC_PROG_CC])
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
26 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
27 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
3748
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
28 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
29 dnl By default, look in $includedir and $libdir.
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
30 use_additional=yes
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
31 AC_LIB_WITH_FINAL_PREFIX([
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
32 eval additional_includedir=\"$includedir\"
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
33 eval additional_libdir=\"$libdir\"
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
34 ])
4528
ae85e65ee361 Get m4 files from the gettext distribution.
Paul Eggert <eggert@cs.ucla.edu>
parents: 3748
diff changeset
35 AC_LIB_ARG_WITH([lib-prefix],
3748
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
36 [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
37 --without-lib-prefix don't search for libraries in includedir and libdir],
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
38 [
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
39 if test "X$withval" = "Xno"; then
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
40 use_additional=no
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
41 else
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
42 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
43 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
44 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
45 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
46 ])
3748
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
47 else
4536
3358eb550c86 Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents: 4533
diff changeset
48 additional_includedir="$withval/include"
6200
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
49 additional_libdir="$withval/$acl_libdirstem"
3748
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
50 fi
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
51 fi
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
52 ])
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
53 if test $use_additional = yes; then
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
54 dnl Potentially add $additional_includedir to $CPPFLAGS.
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
55 dnl But don't add it
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
56 dnl 1. if it's the standard /usr/include,
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
57 dnl 2. if it's already present in $CPPFLAGS,
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
58 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
59 dnl 4. if it doesn't exist as a directory.
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
60 if test "X$additional_includedir" != "X/usr/include"; then
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
61 haveit=
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
62 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
63 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
64 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
65 haveit=yes
3358eb550c86 Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents: 4533
diff changeset
66 break
3358eb550c86 Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents: 4533
diff changeset
67 fi
3748
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
68 done
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
69 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
70 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
71 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
72 case $host_os in
5659
be44f23226e0 Update from GNU gettext 0.14.2.
Bruno Haible <bruno@clisp.org>
parents: 5585
diff changeset
73 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
74 esac
3358eb550c86 Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents: 4533
diff changeset
75 fi
3358eb550c86 Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents: 4533
diff changeset
76 fi
3358eb550c86 Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents: 4533
diff changeset
77 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
78 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
79 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
80 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
81 fi
3358eb550c86 Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents: 4533
diff changeset
82 fi
3748
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
83 fi
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
84 fi
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
85 dnl Potentially add $additional_libdir to $LDFLAGS.
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
86 dnl But don't add it
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
87 dnl 1. if it's the standard /usr/lib,
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
88 dnl 2. if it's already present in $LDFLAGS,
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
89 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
90 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
91 if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
3748
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
92 haveit=
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
93 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
94 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
95 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
96 haveit=yes
3358eb550c86 Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents: 4533
diff changeset
97 break
3358eb550c86 Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents: 4533
diff changeset
98 fi
3748
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
99 done
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
100 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
101 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
102 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
103 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
104 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
105 esac
3358eb550c86 Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents: 4533
diff changeset
106 fi
3358eb550c86 Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents: 4533
diff changeset
107 fi
3358eb550c86 Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents: 4533
diff changeset
108 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
109 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
110 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
111 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
112 fi
3358eb550c86 Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents: 4533
diff changeset
113 fi
3748
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
114 fi
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
115 fi
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
116 fi
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
117 ])
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
118
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
119 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
120 dnl acl_final_exec_prefix, containing the values to which $prefix and
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
121 dnl $exec_prefix will expand at the end of the configure script.
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
122 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
123 [
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
124 dnl Unfortunately, prefix and exec_prefix get only finally determined
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
125 dnl at the end of configure.
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
126 if test "X$prefix" = "XNONE"; then
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
127 acl_final_prefix="$ac_default_prefix"
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
128 else
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
129 acl_final_prefix="$prefix"
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
130 fi
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
131 if test "X$exec_prefix" = "XNONE"; then
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
132 acl_final_exec_prefix='${prefix}'
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
133 else
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
134 acl_final_exec_prefix="$exec_prefix"
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
135 fi
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
136 acl_save_prefix="$prefix"
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
137 prefix="$acl_final_prefix"
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
138 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
139 prefix="$acl_save_prefix"
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
140 ])
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
141
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
142 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
143 dnl variables prefix and exec_prefix bound to the values they will have
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
144 dnl at the end of the configure script.
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
145 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
146 [
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
147 acl_save_prefix="$prefix"
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
148 prefix="$acl_final_prefix"
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
149 acl_save_exec_prefix="$exec_prefix"
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
150 exec_prefix="$acl_final_exec_prefix"
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
151 $1
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
152 exec_prefix="$acl_save_exec_prefix"
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
153 prefix="$acl_save_prefix"
d70d71553cf8 Upgrade to gettext-0.11.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
154 ])
6200
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
155
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
156 dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
157 dnl the basename of the libdir, either "lib" or "lib64".
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
158 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
159 [
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
160 dnl There is no formal standard regarding lib and lib64. The current
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
161 dnl practice is that on a system supporting 32-bit and 64-bit instruction
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
162 dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
163 dnl libraries go under $prefix/lib. We determine the compiler's default
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
164 dnl mode by looking at the compiler's library search path. If at least
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
165 dnl of its elements ends in /lib64 or points to a directory whose absolute
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
166 dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
167 dnl default, namely "lib".
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
168 acl_libdirstem=lib
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
169 searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
170 if test -n "$searchpath"; then
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
171 acl_save_IFS="${IFS= }"; IFS=":"
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
172 for searchdir in $searchpath; do
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
173 if test -d "$searchdir"; then
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
174 case "$searchdir" in
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
175 */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
176 *) searchdir=`cd "$searchdir" && pwd`
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
177 case "$searchdir" in
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
178 */lib64 ) acl_libdirstem=lib64 ;;
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
179 esac ;;
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
180 esac
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
181 fi
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
182 done
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
183 IFS="$acl_save_IFS"
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
184 fi
dae7c9179bef Support for lib vs. lib64 distinction on biarch platforms.
Bruno Haible <bruno@clisp.org>
parents: 5659
diff changeset
185 ])