Merge lp:~stewart/pandora-build/pandora-for-playback into lp:pandora-build

Proposed by Stewart Smith
Status: Needs review
Proposed branch: lp:~stewart/pandora-build/pandora-for-playback
Merge into: lp:pandora-build
Diff against target: 441 lines (+417/-4)
2 files modified
m4/pandora_have_libmysqlclient.m4 (+18/-4)
m4/pandora_have_libpcap.m4 (+399/-0)
To merge this branch: bzr merge lp:~stewart/pandora-build/pandora-for-playback
Reviewer Review Type Date Requested Status
Monty Taylor Pending
Review via email: mp+113329@code.launchpad.net

Description of the change

some fixups and additons we've needed.

To post a comment you must log in.

Unmerged revisions

275. By Stewart Smith

fix have_libmysqlcient for when mysql_config isn't a full path.

274. By Vlad Lesin

Add macros for libpcap.

273. By Vlad Lesin

Store paths to mysql client library headers, binaries and mysqlconfig in MYSQL_INCLUDES, MYSQL_LIBS, MYSQL_CONFIG variables respectively

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'm4/pandora_have_libmysqlclient.m4'
--- m4/pandora_have_libmysqlclient.m4 2011-10-10 15:48:44 +0000
+++ m4/pandora_have_libmysqlclient.m4 2012-07-04 04:52:18 +0000
@@ -30,15 +30,29 @@
30 AC_CACHE_CHECK([for MySQL Base Location],[pandora_cv_mysql_base],[30 AC_CACHE_CHECK([for MySQL Base Location],[pandora_cv_mysql_base],[
3131
32 dnl option 2: something in MYSQL_CONFIG now, use that to get a base dir32 dnl option 2: something in MYSQL_CONFIG now, use that to get a base dir
33 AS_IF([test -f "${MYSQL_CONFIG}" -a -x "${MYSQL_CONFIG}"],[33 AS_IF([test -f "`which ${MYSQL_CONFIG}`" -a -x "`which ${MYSQL_CONFIG}`"],[
34 pandora_cv_mysql_base=$(dirname $(MYSQL_CONFIG --include | sed 's/-I//'))34 pandora_cv_mysql_base=$(dirname $(${MYSQL_CONFIG} --include | sed 's/-I//'))
35 MYSQL_INCLUDES=$(${MYSQL_CONFIG} --include)
36 MYSQL_INCLUDES="$MYSQL_INCLUDES $(echo $MYSQL_INCLUDES|sed -e 's/-I/-isystem /')"
37 MYSQL_LIBS=$(${MYSQL_CONFIG} --libs_r)
35 ],[38 ],[
36 dnl option 1: a directory39 dnl option 1: a directory
37 AS_IF([test -d $with_mysql],[pandora_cv_mysql_base=$with_mysql],[40 AS_IF([test -d $with_mysql],
38 pandora_cv_mysql_base="not found"41 [
42 pandora_cv_mysql_base=$with_mysql
43 IBASE="-I${with_mysql}"
44 MYSQL_CONFIG="${with_mysql}/bin/mysql_config"
45 MYSQL_INCLUDES="$IBASE/include/mysql -isystem $IBASE/include/mysql"
46 MYSQL_LIBS="-L${with_mysql}/lib -L${with_mysql}/lib/mysql -lmysqlclient_r"
47 ],
48 [
49 pandora_cv_mysql_base=""
39 ])50 ])
40 ])51 ])
41 ])52 ])
53 AC_SUBST(MYSQL_CONFIG)
54 AC_SUBST(MYSQL_INCLUDES)
55 AC_SUBST(MYSQL_LIBS)
42])56])
4357
44AC_DEFUN([_PANDORA_SEARCH_LIBMYSQLCLIENT],[58AC_DEFUN([_PANDORA_SEARCH_LIBMYSQLCLIENT],[
4559
=== added file 'm4/pandora_have_libpcap.m4'
--- m4/pandora_have_libpcap.m4 1970-01-01 00:00:00 +0000
+++ m4/pandora_have_libpcap.m4 2012-07-04 04:52:18 +0000
@@ -0,0 +1,399 @@
1dnl Macros that test for specific features.
2dnl This file is part of the Autoconf packaging for Wireshark.
3dnl Copyright (C) 1998-2000 by Gerald Combs.
4dnl
5dnl $Id$
6dnl
7dnl This program is free software; you can redistribute it and/or modify
8dnl it under the terms of the GNU General Public License as published by
9dnl the Free Software Foundation; either version 2, or (at your option)
10dnl any later version.
11dnl
12dnl This program is distributed in the hope that it will be useful,
13dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15dnl GNU General Public License for more details.
16dnl
17dnl You should have received a copy of the GNU General Public License
18dnl along with this program; if not, write to the Free Software
19dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20dnl 02111-1307, USA.
21dnl
22dnl As a special exception, the Free Software Foundation gives unlimited
23dnl permission to copy, distribute and modify the configure scripts that
24dnl are the output of Autoconf. You need not follow the terms of the GNU
25dnl General Public License when using or distributing such scripts, even
26dnl though portions of the text of Autoconf appear in them. The GNU
27dnl General Public License (GPL) does govern all other use of the material
28dnl that constitutes the Autoconf program.
29dnl
30dnl Certain portions of the Autoconf source text are designed to be copied
31dnl (in certain cases, depending on the input) into the output of
32dnl Autoconf. We call these the "data" portions. The rest of the Autoconf
33dnl source text consists of comments plus executable code that decides which
34dnl of the data portions to output in any given case. We call these
35dnl comments and executable code the "non-data" portions. Autoconf never
36dnl copies any of the non-data portions into its output.
37dnl
38dnl This special exception to the GPL applies to versions of Autoconf
39dnl released by the Free Software Foundation. When you make and
40dnl distribute a modified version of Autoconf, you may extend this special
41dnl exception to the GPL to apply to your modified version as well, *unless*
42dnl your modified version has the potential to copy into its output some
43dnl of the text that was the non-data portion of the version that you started
44dnl with. (In other words, unless your change moves or copies text from
45dnl the non-data portions to the data portions.) If your modification has
46dnl such potential, you must delete any notice of this special exception
47dnl to the GPL from your modified version.
48dnl
49dnl Written by David MacKenzie, with help from
50dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
51dnl Roland McGrath, Noah Friedman, david d zuhn, and many others.
52
53#
54# PANDORA_BREAKLOOP_TRY_LINK
55#
56AC_DEFUN([PANDORA_PCAP_BREAKLOOP_TRY_LINK],
57[
58 AC_LINK_IFELSE(
59 [
60 AC_LANG_SOURCE(
61 [[
62# include <pcap.h>
63 int main(void)
64 {
65 pcap_t *pct = NULL;
66 pcap_breakloop(pct);
67 return 0;
68 }
69 ]])
70 ],
71 [
72 ws_breakloop_compiled=yes
73 ],
74 [
75 ws_breakloop_compiled=no
76 ])
77])
78#
79# PANDORA_ADD_DASH_L
80#
81# Add to the variable specified as the first argument a "-L" flag for the
82# directory specified as the second argument, and, on Solaris, add a
83# "-R" flag for it as well.
84#
85# XXX - IRIX, and other OSes, may require some flag equivalent to
86# "-R" here.
87#
88AC_DEFUN([PANDORA_ADD_DASH_L],
89[$1="$$1 -L$2"
90case "$host_os" in
91 solaris*)
92 $1="$$1 -R$2"
93 ;;
94esac
95])
96
97
98#
99# PANDORA_PCAP_CHECK
100#
101AC_DEFUN([PANDORA_HAVE_LIBPCAP],
102[
103 AC_MSG_CHECKING(libpcap)
104
105 AC_ARG_WITH([libpcap],
106 [AS_HELP_STRING([--with-libpcap=PATH],
107 [path to libpcap prefix dir])],
108 [pcap_dir=$withval],
109 )
110
111 if test -z "$pcap_dir"
112 then
113 # Pcap header checks
114 # XXX need to set a var AC_CHECK_HEADER(pcap.h,,)
115
116 #
117 # The user didn't specify a directory in which libpcap resides.
118 # First, look for a pcap-config script.
119 #
120 AC_PATH_PROG(PCAP_CONFIG, pcap-config)
121 else
122 if test -f $pcap_dir/bin/pcap-config -a -x $pcap_dir/bin/pcap-config
123 then
124 PCAP_CONFIG=$pcap_dir/bin/pcap-config
125 fi
126 fi
127
128 if test -n "$PCAP_CONFIG" ; then
129 #
130 # Found it.
131 #
132 # Now check whether it's the libpcap 1.0 version, which
133 # put a space after "-L" - on some platforms, that doesn't
134 # work.
135 #
136 AC_MSG_CHECKING(for broken pcap-config)
137 case `"$PCAP_CONFIG" --libs` in
138
139 "-L "*)
140 #
141 # Space after -L. Pretend pcap-config doesn't exist.
142 #
143 AC_MSG_RESULT(yes)
144 PCAP_CONFIG=""
145 ;;
146
147 *)
148 #
149 # No space after -L.
150 #
151 AC_MSG_RESULT(no)
152 ;;
153 esac
154 fi
155 if test -n "$PCAP_CONFIG" ; then
156 #
157 # Found it, and it's usable; use it to get the include flags
158 # for libpcap.
159 #
160 PCAP_INCLUDES=`"$PCAP_CONFIG" --cflags`
161 else
162 if test -d "$pcap_dir"
163 then
164 PCAP_INCLUDES="-I$pcap_dir/include"
165 PANDORA_ADD_DASH_L(PCAP_LIBS, $pcap_dir/lib)
166 else
167 #
168 # Didn't find it; we have to look for libpcap ourselves.
169 # We assume that the current library search path will work,
170 # but we may have to look for the header in a "pcap"
171 # subdirectory of "/usr/include" or "/usr/local/include",
172 # as some systems apparently put "pcap.h" in a "pcap"
173 # subdirectory, and we also check "$prefix/include" - and
174 # "$prefix/include/pcap", in case $prefix is set to
175 # "/usr/include" or "/usr/local/include".
176 #
177 # XXX - should we just add "$prefix/include" to the include
178 # search path and "$prefix/lib" to the library search path?
179 #
180 AC_MSG_CHECKING(for extraneous pcap header directories)
181 found_pcap_dir=""
182 pcap_dir_list="/usr/include/pcap $prefix/include/pcap $prefix/include"
183 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
184 pcap_dir_list="$pcap_dir_list /usr/local/include/pcap"
185 fi
186 for pcap_dir in $pcap_dir_list
187 do
188 if test -d $pcap_dir ; then
189 if test x$pcap_dir != x/usr/include -a x$pcap_dir != x/usr/local/include ; then
190 PCAP_INCLUDES="-I$pcap_dir"
191 fi
192 found_pcap_dir=" $found_pcap_dir -I$pcap_dir"
193 break
194 fi
195 done
196
197 if test "$found_pcap_dir" != "" ; then
198 AC_MSG_RESULT(found --$found_pcap_dir added to CFLAGS)
199 else
200 AC_MSG_RESULT(not found)
201 fi
202 fi
203 fi
204
205 ac_CFLAGS_saved=$CFLAGS
206 CFLAGS="$PCAP_INCLUDES $CFLAGS"
207 ac_CPPFLAGS_saved=$CPPFLAGS
208 CPPFLAGS="$PCAP_INCLUDES $CPPFLAGS"
209
210 # Pcap header check
211 AC_CHECK_HEADER(pcap.h,,
212 AC_MSG_ERROR([[Header file pcap.h not found; if you installed libpcap
213from source, did you also do \"make install-incl\", and if you installed a
214binary package of libpcap, is there also a developer's package of libpcap,
215and did you also install that package?]]))
216
217
218 if test -n "$PCAP_CONFIG" ; then
219 #
220 # We have pcap-config; we assume that means we have libpcap
221 # installed and that pcap-config will tell us whatever
222 # libraries libpcap needs.
223 #
224 if test x$enable_static = xyes; then
225 PCAP_LIBS=`"$PCAP_CONFIG" --libs --static`
226 else
227 PCAP_LIBS=`"$PCAP_CONFIG" --libs`
228 fi
229 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
230 else
231 #
232 # Check to see if we find "pcap_open_live" in "-lpcap".
233 # Also check for various additional libraries that libpcap might
234 # require.
235 #
236 ac_LDFLAGS_saved=$LDFLAGS
237 LDFLAGS="-L${pcap_dir}/lib"
238 AC_CHECK_LIB(pcap, pcap_open_live,
239 [
240 PCAP_LIBS="-L${pcap_dir}/lib -lpcap"
241 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
242 ], [
243 ac_wireshark_extras_found=no
244 ac_save_LIBS="$LIBS"
245 for extras in "-lcfg -lodm" "-lpfring"
246 do
247 AC_MSG_CHECKING([for pcap_open_live in -lpcap with $extras])
248 LIBS="-lpcap $extras"
249 #
250 # XXX - can't we use AC_CHECK_LIB here?
251 #
252 AC_TRY_LINK(
253 [
254# include <pcap.h>
255 ],
256 [
257 pcap_open_live(NULL, 0, 0, 0, NULL);
258 ],
259 [
260 ac_wireshark_extras_found=yes
261 AC_MSG_RESULT([yes])
262 PCAP_LIBS="-lpcap $extras"
263 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
264 ],
265 [
266 AC_MSG_RESULT([no])
267 ])
268 if test x$ac_wireshark_extras_found = xyes
269 then
270 break
271 fi
272 done
273 if test x$ac_wireshark_extras_found = xno
274 then
275 AC_MSG_ERROR([Can't link with library libpcap.])
276 fi
277 LIBS=$ac_save_LIBS
278 ])
279 LDFLAGS=$ac_LDFLAGS_saved
280 fi
281
282 #
283 # Check whether various variables and functions are defined by
284 # libpcap.
285 #
286 ac_save_LIBS="$LIBS"
287 LIBS="$PCAP_LIBS $LIBS"
288 AC_CHECK_FUNCS(pcap_open_dead pcap_freecode)
289 #
290 # pcap_breakloop may be present in the library but not declared
291 # in the pcap.h header file. If it's not declared in the header
292 # file, attempts to use it will get warnings, and, if we're
293 # building with warnings treated as errors, that warning will
294 # cause compilation to fail.
295 #
296 # We are therefore first testing whether the function is present
297 # and then, if we're compiling with warnings as errors, testing
298 # whether it is usable. It is usable if it compiles without
299 # a -Wimplicit warning (the "compile with warnings as errors"
300 # option requires GCC). If it is not usable, we fail and tell
301 # the user that the pcap.h header needs to be updated.
302 #
303 # Ceteris paribus, this should only happen with Mac OS X 10.3[.x] which
304 # can have an up-to-date pcap library without the corresponding pcap
305 # header.
306 #
307 # However, it might also happen on some others OSes with some erroneous
308 # system manipulations where multiple versions of libcap might co-exist
309 # e.g. hand made symbolic link from libpcap.so -> libpcap.so.0.8 but
310 # having the pcap header version 0.7.
311 #
312 AC_MSG_CHECKING([whether pcap_breakloop is present])
313 CFLAGS="$PCAP_INCLUDES $CFLAGS"
314 PANDORA_PCAP_BREAKLOOP_TRY_LINK
315 if test "x$ws_breakloop_compiled" = "xyes"; then
316 AC_MSG_RESULT(yes)
317 AC_DEFINE(HAVE_PCAP_BREAKLOOP, 1, [Define if pcap_breakloop is known])
318 if test "x$with_warnings_as_errors" = "xyes"; then
319 AC_MSG_CHECKING([whether pcap_breakloop is usable])
320 CFLAGS="$CFLAGS -Werror -Wimplicit"
321 PANDORA_PCAP_BREAKLOOP_TRY_LINK
322 if test "x$ws_breakloop_compiled" = "xyes"; then
323 AC_MSG_RESULT(yes)
324 else
325 AC_MSG_RESULT(no)
326 AC_MSG_ERROR(
327[Your pcap library is more recent than your pcap header.
328As you are building with compiler warnings treated as errors, Wireshark
329won't be able to use functions not declared in that header.
330If you wish to build with compiler warnings treated as errors, You should
331install a newer version of the header file.])
332 fi
333 fi
334 else
335 AC_MSG_RESULT(no)
336 fi
337
338 #
339 # Later versions of Mac OS X 10.3[.x] ship a pcap.h that
340 # doesn't define pcap_if_t but ship an 0.8[.x] libpcap,
341 # so the library has "pcap_findalldevs()", but pcap.h
342 # doesn't define "pcap_if_t" so you can't actually *use*
343 # "pcap_findalldevs()".
344 #
345 # That even appears to be true of systems shipped with
346 # 10.3.4, so it doesn't appear only to be a case of
347 # Software Update not updating header files.
348 #
349 # (You can work around this by installing the 0.8 header
350 # files.)
351 #
352 AC_CACHE_CHECK([whether pcap_findalldevs is present and usable],
353 [ac_cv_func_pcap_findalldevs],
354 [
355 AC_LINK_IFELSE(
356 [
357 AC_LANG_SOURCE(
358 [[
359 #include <pcap.h>
360 main()
361 {
362 pcap_if_t *devpointer;
363 char errbuf[1];
364
365 pcap_findalldevs(&devpointer, errbuf);
366 }
367 ]])
368 ],
369 [
370 ac_cv_func_pcap_findalldevs=yes
371 ],
372 [
373 ac_cv_func_pcap_findalldevs=no
374 ])
375 ])
376 #
377 # Don't check for other new routines that showed up after
378 # "pcap_findalldevs()" if we don't have a usable
379 # "pcap_findalldevs()", so we don't end up using them if the
380 # "pcap.h" is crufty and old and doesn't declare them.
381 #
382 if test $ac_cv_func_pcap_findalldevs = "yes" ; then
383 AC_DEFINE(HAVE_PCAP_FINDALLDEVS, 1,
384 [Define to 1 if you have the `pcap_findalldevs' function and a pcap.h that declares pcap_if_t.])
385 AC_CHECK_FUNCS(pcap_datalink_val_to_name pcap_datalink_name_to_val)
386 AC_CHECK_FUNCS(pcap_datalink_val_to_description)
387 AC_CHECK_FUNCS(pcap_list_datalinks pcap_set_datalink pcap_lib_version)
388 AC_CHECK_FUNCS(pcap_get_selectable_fd pcap_free_datalinks)
389 AC_CHECK_FUNCS(pcap_create bpf_image)
390 fi
391 LIBS="$ac_save_LIBS"
392
393 CFLAGS=$ac_CFLAGS_saved
394 CPPFLAGS=$ac_CPPFLAGS_saved
395
396 AC_SUBST(PCAP_LIBS)
397 AC_SUBST(PCAP_INCLUDES)
398])
399

Subscribers

People subscribed via source and target branches

to all changes: