Skip to content

Commit

Permalink
libnl building support, easybutton pcap 1.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
awick committed Feb 21, 2014
1 parent de97a8f commit 245989f
Show file tree
Hide file tree
Showing 3 changed files with 336 additions and 3 deletions.
275 changes: 273 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ enable_option_checking
enable_dependency_tracking
with_pfring
with_libpcap
with_libnl
with_libnids
with_yara
with_GeoIP
Expand Down Expand Up @@ -1347,6 +1348,8 @@ Optional Packages:
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-pfring=DIR use pfring build directory
--with-libpcap=DIR use libpcap build directory
--without-libnl disable libnl support [default=yes, on Linux, if
present]
--with-libnids=DIR use libnids build directory
--with-yara=DIR use yara build directory
--with-GeoIP=DIR use GeoIP build directory
Expand Down Expand Up @@ -4253,6 +4256,274 @@ $as_echo "yes" >&6; }
fi
# Do we have libnl?
# Modfied version of whats in libpcap configure.ac. Thank you libpcap!
#
# Check whether --with-libnl was given.
if test "${with_libnl+set}" = set; then
withval=$with_libnl; with_libnl=$withval
fi
if test x$with_libnl != xno ; then
have_any_nl="no"
#
# Try libnl 3.x first.
#
{ $as_echo "$as_me:$LINENO: checking for nl_socket_alloc in -lnl-3" >&5
$as_echo_n "checking for nl_socket_alloc in -lnl-3... " >&6; }
if test "${ac_cv_lib_nl_3_nl_socket_alloc+set}" = set; then
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lnl-3 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char nl_socket_alloc ();
int
main ()
{
return nl_socket_alloc ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
ac_cv_lib_nl_3_nl_socket_alloc=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_nl_3_nl_socket_alloc=no
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_nl_3_nl_socket_alloc" >&5
$as_echo "$ac_cv_lib_nl_3_nl_socket_alloc" >&6; }
if test "x$ac_cv_lib_nl_3_nl_socket_alloc" = x""yes; then
#
# Yes, we have libnl 3.x.
#
PCAP_LIBS="$PCAP_LIBS -lnl-genl-3 -lnl-3"
have_any_nl="yes"
fi
if test x$have_any_nl = xno ; then
#
# Try libnl 2.x
#
{ $as_echo "$as_me:$LINENO: checking for nl_socket_alloc in -lnl" >&5
$as_echo_n "checking for nl_socket_alloc in -lnl... " >&6; }
if test "${ac_cv_lib_nl_nl_socket_alloc+set}" = set; then
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lnl $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char nl_socket_alloc ();
int
main ()
{
return nl_socket_alloc ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
ac_cv_lib_nl_nl_socket_alloc=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_nl_nl_socket_alloc=no
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_nl_nl_socket_alloc" >&5
$as_echo "$ac_cv_lib_nl_nl_socket_alloc" >&6; }
if test "x$ac_cv_lib_nl_nl_socket_alloc" = x""yes; then
#
# Yes, we have libnl 2.x.
#
PCAP_LIBS="$PCAP_LIBS -lnl-genl -lnl"
have_any_nl="yes"
fi
fi
if test x$have_any_nl = xno ; then
#
# No, we don't; do we have libnl 1.x?
#
{ $as_echo "$as_me:$LINENO: checking for nl_handle_alloc in -lnl" >&5
$as_echo_n "checking for nl_handle_alloc in -lnl... " >&6; }
if test "${ac_cv_lib_nl_nl_handle_alloc+set}" = set; then
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lnl $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char nl_handle_alloc ();
int
main ()
{
return nl_handle_alloc ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
ac_cv_lib_nl_nl_handle_alloc=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_nl_nl_handle_alloc=no
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_nl_nl_handle_alloc" >&5
$as_echo "$ac_cv_lib_nl_nl_handle_alloc" >&6; }
if test "x$ac_cv_lib_nl_nl_handle_alloc" = x""yes; then
#
# Yes.
#
PCAP_LIBS="$PCAP_LIBS -lnl"
have_any_nl="yes"
fi
fi
if test x$have_any_nl = xno ; then
#
# No, we don't have libnl at all.
#
if test x$with_libnl = xyes ; then
{ { $as_echo "$as_me:$LINENO: error: libnl support requested but libnl not found" >&5
$as_echo "$as_me: error: libnl support requested but libnl not found" >&2;}
{ (exit 1); exit 1; }; }
fi
fi
fi
{ $as_echo "$as_me:$LINENO: checking for libnids" >&5
Expand Down Expand Up @@ -4617,8 +4888,8 @@ $as_echo "$as_me: error: glib.h or libglib-2.0.a not found in $withval" >&2;}
esac
else
GLIB2_CFLAGS=`pkg-config gio-2.0 gobject-2.0 gthread-2.0 glib-2.0 --cflags`
GLIB2_LIBS=`pkg-config gio-2.0 gobject-2.0 gthread-2.0 glib-2.0 --libs`
GLIB2_CFLAGS=`pkg-config gio-2.0 gobject-2.0 gthread-2.0 glib-2.0 gmodule-2.0 --cflags`
GLIB2_LIBS=`pkg-config gio-2.0 gobject-2.0 gthread-2.0 glib-2.0 gmodule-2.0 --libs`
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
fi
Expand Down
62 changes: 62 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,68 @@ esac ], [
fi
fi
AC_MSG_RESULT(yes) ])

# Do we have libnl?
# Modfied version of whats in libpcap configure.ac. Thank you libpcap!
#
AC_ARG_WITH(libnl,
AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
with_libnl=$withval,,)

if test x$with_libnl != xno ; then
have_any_nl="no"

#
# Try libnl 3.x first.
#
AC_CHECK_LIB(nl-3, nl_socket_alloc,
[
#
# Yes, we have libnl 3.x.
#
PCAP_LIBS="$PCAP_LIBS -lnl-genl-3 -lnl-3"
have_any_nl="yes"
])

if test x$have_any_nl = xno ; then
#
# Try libnl 2.x
#
AC_CHECK_LIB(nl, nl_socket_alloc,
[
#
# Yes, we have libnl 2.x.
#
PCAP_LIBS="$PCAP_LIBS -lnl-genl -lnl"
have_any_nl="yes"
])
fi

if test x$have_any_nl = xno ; then
#
# No, we don't; do we have libnl 1.x?
#
AC_CHECK_LIB(nl, nl_handle_alloc,
[
#
# Yes.
#
PCAP_LIBS="$PCAP_LIBS -lnl"
have_any_nl="yes"
])
fi

if test x$have_any_nl = xno ; then
#
# No, we don't have libnl at all.
#
if test x$with_libnl = xyes ; then
AC_MSG_ERROR([libnl support requested but libnl not found])
fi
fi
fi


AC_SUBST(PCAP_CFLAGS)
AC_SUBST(PCAP_LIBS)

Expand Down
2 changes: 1 addition & 1 deletion easybutton-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
GLIB=2.34.3
YARA=1.7
GEOIP=1.4.8
PCAP=1.5.1
PCAP=1.5.3
NIDS=1.24
PFRING=5.6.1

Expand Down

0 comments on commit 245989f

Please sign in to comment.