Mercurial > hg > octave-kai > gnulib-hg
annotate m4/lib-prefix.m4 @ 4897:c784af02fcd9
updates from savannah outage
author | uid65818 <uid65818> |
---|---|
date | Wed, 24 Dec 2003 13:07:08 +0000 |
parents | 3358eb550c86 |
children | adff74659d81 |
rev | line source |
---|---|
4897 | 1 # lib-prefix.m4 serial 3 (gettext-0.13) |
4528
ae85e65ee361
Get m4 files from the gettext distribution.
Paul Eggert <eggert@cs.ucla.edu>
parents:
3748
diff
changeset
|
2 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. |
3748 | 3 dnl This file is free software, distributed under the terms of the GNU |
4 dnl General Public License. As a special exception to the GNU General | |
5 dnl Public License, this file may be distributed as part of a program | |
6 dnl that contains a configuration script generated by Autoconf, under | |
7 dnl the same distribution terms as the rest of that program. | |
8 | |
9 dnl From Bruno Haible. | |
10 | |
4528
ae85e65ee361
Get m4 files from the gettext distribution.
Paul Eggert <eggert@cs.ucla.edu>
parents:
3748
diff
changeset
|
11 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
|
12 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
|
13 dnl require excessive bracketing. |
ae85e65ee361
Get m4 files from the gettext distribution.
Paul Eggert <eggert@cs.ucla.edu>
parents:
3748
diff
changeset
|
14 ifdef([AC_HELP_STRING], |
ae85e65ee361
Get m4 files from the gettext distribution.
Paul Eggert <eggert@cs.ucla.edu>
parents:
3748
diff
changeset
|
15 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], |
4897 | 16 [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
|
17 |
3748 | 18 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed |
19 dnl to access previously installed libraries. The basic assumption is that | |
20 dnl a user will want packages to use other packages he previously installed | |
21 dnl with the same --prefix option. | |
22 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate | |
23 dnl libraries, but is otherwise very convenient. | |
24 AC_DEFUN([AC_LIB_PREFIX], | |
25 [ | |
26 AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) | |
27 AC_REQUIRE([AC_PROG_CC]) | |
28 AC_REQUIRE([AC_CANONICAL_HOST]) | |
29 AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) | |
30 dnl By default, look in $includedir and $libdir. | |
31 use_additional=yes | |
32 AC_LIB_WITH_FINAL_PREFIX([ | |
33 eval additional_includedir=\"$includedir\" | |
34 eval additional_libdir=\"$libdir\" | |
35 ]) | |
4528
ae85e65ee361
Get m4 files from the gettext distribution.
Paul Eggert <eggert@cs.ucla.edu>
parents:
3748
diff
changeset
|
36 AC_LIB_ARG_WITH([lib-prefix], |
3748 | 37 [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib |
38 --without-lib-prefix don't search for libraries in includedir and libdir], | |
39 [ | |
40 if test "X$withval" = "Xno"; then | |
41 use_additional=no | |
42 else | |
43 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
|
44 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
|
45 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
|
46 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
|
47 ]) |
3748 | 48 else |
4536
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
49 additional_includedir="$withval/include" |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
50 additional_libdir="$withval/lib" |
3748 | 51 fi |
52 fi | |
53 ]) | |
54 if test $use_additional = yes; then | |
55 dnl Potentially add $additional_includedir to $CPPFLAGS. | |
56 dnl But don't add it | |
57 dnl 1. if it's the standard /usr/include, | |
58 dnl 2. if it's already present in $CPPFLAGS, | |
59 dnl 3. if it's /usr/local/include and we are using GCC on Linux, | |
60 dnl 4. if it doesn't exist as a directory. | |
61 if test "X$additional_includedir" != "X/usr/include"; then | |
62 haveit= | |
63 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
|
64 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
|
65 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
|
66 haveit=yes |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
67 break |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
68 fi |
3748 | 69 done |
70 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
|
71 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
|
72 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
|
73 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
|
74 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
|
75 esac |
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 fi |
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 -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
|
79 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
|
80 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
|
81 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
|
82 fi |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
83 fi |
3748 | 84 fi |
85 fi | |
86 dnl Potentially add $additional_libdir to $LDFLAGS. | |
87 dnl But don't add it | |
88 dnl 1. if it's the standard /usr/lib, | |
89 dnl 2. if it's already present in $LDFLAGS, | |
90 dnl 3. if it's /usr/local/lib and we are using GCC on Linux, | |
91 dnl 4. if it doesn't exist as a directory. | |
92 if test "X$additional_libdir" != "X/usr/lib"; then | |
93 haveit= | |
94 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
|
95 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
|
96 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
|
97 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 break |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
99 fi |
3748 | 100 done |
101 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
|
102 if test "X$additional_libdir" = "X/usr/local/lib"; then |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
103 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
|
104 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
|
105 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
|
106 esac |
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 fi |
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 -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
|
110 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
|
111 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
|
112 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
|
113 fi |
3358eb550c86
Leave whitespace alone when importing, undoing that part of yesterday's
Paul Eggert <eggert@cs.ucla.edu>
parents:
4533
diff
changeset
|
114 fi |
3748 | 115 fi |
116 fi | |
117 fi | |
118 ]) | |
119 | |
120 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, | |
121 dnl acl_final_exec_prefix, containing the values to which $prefix and | |
122 dnl $exec_prefix will expand at the end of the configure script. | |
123 AC_DEFUN([AC_LIB_PREPARE_PREFIX], | |
124 [ | |
125 dnl Unfortunately, prefix and exec_prefix get only finally determined | |
126 dnl at the end of configure. | |
127 if test "X$prefix" = "XNONE"; then | |
128 acl_final_prefix="$ac_default_prefix" | |
129 else | |
130 acl_final_prefix="$prefix" | |
131 fi | |
132 if test "X$exec_prefix" = "XNONE"; then | |
133 acl_final_exec_prefix='${prefix}' | |
134 else | |
135 acl_final_exec_prefix="$exec_prefix" | |
136 fi | |
137 acl_save_prefix="$prefix" | |
138 prefix="$acl_final_prefix" | |
139 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" | |
140 prefix="$acl_save_prefix" | |
141 ]) | |
142 | |
143 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the | |
144 dnl variables prefix and exec_prefix bound to the values they will have | |
145 dnl at the end of the configure script. | |
146 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], | |
147 [ | |
148 acl_save_prefix="$prefix" | |
149 prefix="$acl_final_prefix" | |
150 acl_save_exec_prefix="$exec_prefix" | |
151 exec_prefix="$acl_final_exec_prefix" | |
152 $1 | |
153 exec_prefix="$acl_save_exec_prefix" | |
154 prefix="$acl_save_prefix" | |
155 ]) |