/[cvs]/eggdrop1.9/acconfig/mpatrol.m4
ViewVC logotype

Contents of /eggdrop1.9/acconfig/mpatrol.m4

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download)
Thu Jun 10 23:59:16 2004 UTC (15 years, 4 months ago) by takeda
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +2 -2 lines
* fixed some warnings and errors while compiling/generating autoconf on FreeBSD

1 dnl mpatrol
2 dnl A library for controlling and tracing dynamic memory allocations.
3 dnl Copyright (C) 1997-2002 Graeme S. Roy <graeme.roy@analog.com>
4 dnl
5 dnl This library is free software; you can redistribute it and/or
6 dnl modify it under the terms of the GNU Library General Public
7 dnl License as published by the Free Software Foundation; either
8 dnl version 2 of the License, or (at your option) any later version.
9 dnl
10 dnl This library is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 dnl Library General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU Library General Public
16 dnl License along with this library; if not, write to the Free
17 dnl Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18 dnl MA 02111-1307, USA.
19
20
21 dnl Automake macro to build with the mpatrol library
22
23
24 dnl $Id: mpatrol.m4,v 1.2 2003/03/07 12:12:10 tothwolf Exp $
25
26
27 # serial 1
28
29
30 # AM_WITH_MPATROL(DEFAULT)
31 # Check whether to build with the mpatrol library and also attempt to
32 # determine the support libraries that also need to be linked in when
33 # libmpatrol is used. If `DEFAULT' is not specified then it is `no'.
34 # If `DEFAULT' is `threads' then the threadsafe version of the mpatrol
35 # library will be used.
36
37 AC_DEFUN([AM_WITH_MPATROL], [
38 # Firstly, determine if the mpatrol library should be used.
39
40 AC_MSG_CHECKING(if mpatrol should be used)
41 AC_ARG_WITH(mpatrol,
42 [ --with-mpatrol build with the mpatrol library],
43 [case "$withval" in
44 threads)
45 am_with_mpatrol=1
46 am_with_mpatrol_threads=1;;
47 yes)
48 am_with_mpatrol=1
49 am_with_mpatrol_threads=0;;
50 no)
51 am_with_mpatrol=0
52 am_with_mpatrol_threads=0;;
53 *)
54 AC_MSG_RESULT(no)
55 AC_MSG_ERROR(invalid value $withval for --with-mpatrol);;
56 esac
57 ],
58 [if test "x[$1]" = x
59 then
60 am_with_mpatrol=0
61 am_with_mpatrol_threads=0
62 elif test "[$1]" = no
63 then
64 am_with_mpatrol=0
65 am_with_mpatrol_threads=0
66 elif test "[$1]" = yes
67 then
68 am_with_mpatrol=1
69 am_with_mpatrol_threads=0
70 elif test "[$1]" = threads
71 then
72 am_with_mpatrol=1
73 am_with_mpatrol_threads=1
74 else
75 AC_MSG_RESULT(no)
76 AC_MSG_ERROR(invalid argument [$1])
77 fi
78 ]
79 )
80
81 if test "$am_with_mpatrol" = 1
82 then
83 AC_MSG_RESULT(yes)
84
85 # Next, determine which support libraries are available on this
86 # system. If we don't do this here then we can't link later with
87 # the mpatrol library to perform any further tests.
88
89 am_with_mpatrol_libs=""
90 AC_CHECK_LIB(ld, ldopen,
91 am_with_mpatrol_libs="$am_with_mpatrol_libs -lld")
92 AC_CHECK_LIB(elf, elf_begin,
93 am_with_mpatrol_libs="$am_with_mpatrol_libs -lelf")
94 AC_CHECK_LIB(bfd, bfd_init,
95 am_with_mpatrol_libs="$am_with_mpatrol_libs -lbfd -liberty", ,
96 -liberty)
97 AC_CHECK_LIB(imagehlp, SymInitialize,
98 am_with_mpatrol_libs="$am_with_mpatrol_libs -limagehlp")
99 AC_CHECK_LIB(cl, U_get_previous_frame,
100 am_with_mpatrol_libs="$am_with_mpatrol_libs -lcl")
101 AC_CHECK_LIB(exc, unwind,
102 am_with_mpatrol_libs="$am_with_mpatrol_libs -lexc")
103
104 # Now determine which libraries really need to be linked in with
105 # the version of libmpatrol that is on this system. For example,
106 # if the system has libelf and libbfd, we need to determine which
107 # of these, if any, libmpatrol was built with support for.
108
109 am_with_mpatrol_libs2=""
110 AC_CHECK_LIB(mpatrol, __mp_libld,
111 am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lld", ,
112 $am_with_mpatrol_libs)
113 AC_CHECK_LIB(mpatrol, __mp_libelf,
114 am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lelf", ,
115 $am_with_mpatrol_libs)
116 AC_CHECK_LIB(mpatrol, __mp_libbfd,
117 am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lbfd -liberty", ,
118 $am_with_mpatrol_libs)
119 AC_CHECK_LIB(mpatrol, __mp_libimagehlp,
120 am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -limagehlp", ,
121 $am_with_mpatrol_libs)
122 AC_CHECK_LIB(mpatrol, __mp_libcl,
123 am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lcl", ,
124 $am_with_mpatrol_libs)
125 AC_CHECK_LIB(mpatrol, __mp_libexc,
126 am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lexc", ,
127 $am_with_mpatrol_libs)
128
129 # If we are using the threadsafe mpatrol library then we may also need
130 # to link in the threads library. We check blindly for pthreads here
131 # even if we don't need them (in which case it doesn't matter) since
132 # the threads libraries are linked in by default on AmigaOS, Windows
133 # and Netware and it is only UNIX systems that we need to worry about.
134
135 if test "$am_with_mpatrol_threads" = 1
136 then
137 AC_CHECK_LIB(pthread, pthread_mutex_init,
138 am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lpthread", [
139 AC_CHECK_LIB(pthreads, pthread_mutex_init,
140 am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lpthreads", [
141 AC_CHECK_LIB(thread, pthread_mutex_init,
142 am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lthread")
143 ]
144 )
145 ]
146 )
147 fi
148
149 # We now know what libraries to use in order to link with libmpatrol.
150
151 AC_DEFINE(HAVE_MPATROL, 1, [Define if using mpatrol])
152 if test "$am_with_mpatrol_threads" = 1
153 then
154 LIBS="-lmpatrolmt $am_with_mpatrol_libs2 $LIBS"
155 else
156 LIBS="-lmpatrol $am_with_mpatrol_libs2 $LIBS"
157 fi
158
159 # Finally, verify that mpatrol is correctly installed and that we can
160 # link a simple program with it.
161
162 AC_CACHE_CHECK(for working mpatrol, am_cv_with_mpatrol, [
163 AC_TRY_LINK([#include <mpatrol.h>], [
164 int main(void)
165 {
166 malloc(4);
167 return EXIT_SUCCESS;
168 }
169 ],
170 [am_cv_with_mpatrol=yes],
171 [am_cv_with_mpatrol=no]
172 )
173 ]
174 )
175
176 if test "$am_cv_with_mpatrol" = no
177 then
178 AC_MSG_ERROR(mpatrol not installed correctly)
179 fi
180 else
181 AC_MSG_RESULT(no)
182 fi
183 ]
184 )

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23