summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-07-09 20:16:40 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-07-09 20:20:52 +0200
commitd4e385dd0e633525666bf95c56a2045bacc2a485 (patch)
treea87c451e7f988b65d5a3e350969ca765cff02add /configure
parentc07bdeb7419baf7f66e8de386744be9ec4891bb3 (diff)
configure: fix multiple issues in build configuration
This patch is a bundle of multiple fixes. 1) Fix compilation of astraceroute when HAVE_LIBPCAP=1: astraceroute doesn't need libpcap, so add an additional guard/define to bpf.h and bpf_comp.c and netsniff-ng.c. Also since we generate a config.h file, we do not need to have this additional compile flag anymore. 2) Fix tstamping.{h,c} to use the configure script instead of the Makefile. For doing this, also fix the object inclusion in netsniff-ng/Makefile. Last but not least, rename __WITH_... into HAVE_... as this is more clean. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure67
1 files changed, 66 insertions, 1 deletions
diff --git a/configure b/configure
index 7998572..120d5bf 100755
--- a/configure
+++ b/configure
@@ -12,6 +12,9 @@ MISSING_NACL=0
TOOLS="netsniff-ng trafgen astraceroute flowtop ifpps bpfc curvetun mausezahn"
TOOLS_NOBUILD=""
+HAVE_LIBPCAP=0
+HAVE_HWTSTAMP=0
+
[ -z $CC ] && CC=cc
TMPDIR=$(mktemp -d config.XXXXXX)
@@ -369,6 +372,55 @@ EOF
else
echo "[YES]"
echo "CONFIG_LIBPCAP=1" >> Config
+ HAVE_LIBPCAP=1
+ fi
+}
+
+check_hwtstamp()
+{
+ echo -n "[*] Checking hw timestamping ... "
+
+ cat > $TMPDIR/hwtstest.c << EOF
+#include <string.h>
+#include <arpa/inet.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <linux/sockios.h>
+#include <linux/net_tstamp.h>
+#include <linux/if_packet.h>
+#include <linux/if_ether.h>
+#include <linux/if.h>
+
+void main(void)
+{
+ int timesource = SOF_TIMESTAMPING_RAW_HARDWARE, ret;
+ int sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
+ struct hwtstamp_config hwconfig;
+ struct ifreq ifr;
+
+ memset(&hwconfig, 0, sizeof(hwconfig));
+ hwconfig.tx_type = HWTSTAMP_TX_OFF;
+ hwconfig.rx_filter = HWTSTAMP_FILTER_ALL;
+
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, "lo", sizeof(ifr.ifr_name));
+ ifr.ifr_data = &hwconfig;
+
+ ioctl(sock, SIOCSHWTSTAMP, &ifr);
+ setsockopt(sock, SOL_PACKET, PACKET_TIMESTAMP, &timesource,
+ sizeof(timesource));
+}
+EOF
+
+ $CC -o $TMPDIR/hwtstest $TMPDIR/hwtstest.c >> $TMPDIR/config.log 2>&1
+ if [ ! -x $TMPDIR/hwtstest ] ; then
+ echo "[NO]"
+ echo "CONFIG_HWTSTAMP=0" >> Config
+ else
+ echo "[YES]"
+ echo "CONFIG_HWTSTAMP=1" >> Config
+ HAVE_HWTSTAMP=1
fi
}
@@ -422,8 +474,19 @@ EOF
gen_config_hdr()
{
local _version="`git describe --always`"
+ local _have_libpcap=""
+ local _have_hwts=""
+
echo "[*] Generating config.h ... "
+ if [ "$HAVE_LIBPCAP" == "1" ] ; then
+ _have_libpcap="#define HAVE_TCPDUMP_LIKE_FILTER 1"
+ fi
+
+ if [ "$HAVE_HWTSTAMP" == "1" ] ; then
+ _have_hwts="#define HAVE_HARDWARE_TIMESTAMPING 1"
+ fi
+
cat > config.h << EOF
#ifndef CONFIG_H
#define CONFIG_H
@@ -433,6 +496,8 @@ gen_config_hdr()
#define FILE_PUBKEY ".curvetun/pub.key"
#define FILE_USERNAM ".curvetun/username"
#define GITVERSION "$_version"
+$_have_libpcap
+$_have_hwts
#endif /* CONFIG_H */
EOF
}
@@ -456,7 +521,7 @@ check_libgeoip
check_zlib
check_urcu
check_libpcap
-# mausezahn dependencies
+check_hwtstamp
check_libcli
check_libnet