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

Subscribers

People subscribed via source and target branches

to all changes: