annotate m4/lib-prefix.m4 @ 1439:bd0b46c8a70e trunk

[svn] - i believe we've got it!
author nenolod
date Fri, 28 Jul 2006 00:46:34 -0700
parents cb178e5ad177
children 2df5e83c9bf4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 # lib-prefix.m4 serial 2 (gettext-0.12)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3 dnl This file is free software, distributed under the terms of the GNU
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4 dnl General Public License. As a special exception to the GNU General
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5 dnl Public License, this file may be distributed as part of a program
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 dnl that contains a configuration script generated by Autoconf, under
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 dnl the same distribution terms as the rest of that program.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 dnl From Bruno Haible.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 dnl require excessive bracketing.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 ifdef([AC_HELP_STRING],
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 dnl to access previously installed libraries. The basic assumption is that
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 dnl a user will want packages to use other packages he previously installed
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21 dnl with the same --prefix option.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 dnl libraries, but is otherwise very convenient.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 AC_DEFUN([AC_LIB_PREFIX],
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25 [
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27 AC_REQUIRE([AC_PROG_CC])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 AC_REQUIRE([AC_CANONICAL_HOST])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 dnl By default, look in $includedir and $libdir.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 use_additional=yes
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32 AC_LIB_WITH_FINAL_PREFIX([
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33 eval additional_includedir=\"$includedir\"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 eval additional_libdir=\"$libdir\"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35 ])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 AC_LIB_ARG_WITH([lib-prefix],
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38 --without-lib-prefix don't search for libraries in includedir and libdir],
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 [
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40 if test "X$withval" = "Xno"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41 use_additional=no
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43 if test "X$withval" = "X"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 AC_LIB_WITH_FINAL_PREFIX([
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45 eval additional_includedir=\"$includedir\"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 eval additional_libdir=\"$libdir\"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47 ])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 additional_includedir="$withval/include"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50 additional_libdir="$withval/lib"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 ])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 if test $use_additional = yes; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55 dnl Potentially add $additional_includedir to $CPPFLAGS.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56 dnl But don't add it
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57 dnl 1. if it's the standard /usr/include,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58 dnl 2. if it's already present in $CPPFLAGS,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 dnl 4. if it doesn't exist as a directory.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 if test "X$additional_includedir" != "X/usr/include"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 haveit=
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 for x in $CPPFLAGS; do
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 if test "X$x" = "X-I$additional_includedir"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66 haveit=yes
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 break
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 done
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 if test -z "$haveit"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 if test "X$additional_includedir" = "X/usr/local/include"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 if test -n "$GCC"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73 case $host_os in
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74 linux*) haveit=yes;;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 esac
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 if test -z "$haveit"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79 if test -d "$additional_includedir"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80 dnl Really add $additional_includedir to $CPPFLAGS.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 dnl Potentially add $additional_libdir to $LDFLAGS.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87 dnl But don't add it
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88 dnl 1. if it's the standard /usr/lib,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89 dnl 2. if it's already present in $LDFLAGS,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91 dnl 4. if it doesn't exist as a directory.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 if test "X$additional_libdir" != "X/usr/lib"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93 haveit=
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94 for x in $LDFLAGS; do
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 if test "X$x" = "X-L$additional_libdir"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 haveit=yes
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 break
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 done
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 if test -z "$haveit"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102 if test "X$additional_libdir" = "X/usr/local/lib"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103 if test -n "$GCC"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104 case $host_os in
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105 linux*) haveit=yes;;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106 esac
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 if test -z "$haveit"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110 if test -d "$additional_libdir"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111 dnl Really add $additional_libdir to $LDFLAGS.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118 ])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121 dnl acl_final_exec_prefix, containing the values to which $prefix and
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122 dnl $exec_prefix will expand at the end of the configure script.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124 [
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125 dnl Unfortunately, prefix and exec_prefix get only finally determined
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126 dnl at the end of configure.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127 if test "X$prefix" = "XNONE"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128 acl_final_prefix="$ac_default_prefix"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130 acl_final_prefix="$prefix"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
131 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
132 if test "X$exec_prefix" = "XNONE"; then
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133 acl_final_exec_prefix='${prefix}'
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
134 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
135 acl_final_exec_prefix="$exec_prefix"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
136 fi
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
137 acl_save_prefix="$prefix"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138 prefix="$acl_final_prefix"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140 prefix="$acl_save_prefix"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 ])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
142
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
144 dnl variables prefix and exec_prefix bound to the values they will have
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
145 dnl at the end of the configure script.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147 [
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148 acl_save_prefix="$prefix"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149 prefix="$acl_final_prefix"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150 acl_save_exec_prefix="$exec_prefix"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151 exec_prefix="$acl_final_exec_prefix"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152 $1
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 exec_prefix="$acl_save_exec_prefix"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154 prefix="$acl_save_prefix"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155 ])