From f72460bd5176c0c1a058b6e0e7bd236dfab188c9 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 24 Jun 2013 11:29:44 +0200 Subject: configure: Add configure script used to detect NaCl In order to use an installation of NaCl provided by the distro or by previous manual installation, provide a configure script which checks for nacl's presence. Also check of libnl-genl headers. More checks of the other libraries depended on by netsniff-ng as well as checks for necessary kernel headers should be added here too. The configure script is preliminary and has not yet extensively been tested on multiple systems. The concept was inspired by the configure script of trinity and iproute2. Signed-off-by: Tobias Klauser --- Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 8a8b76b..ee03d86 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,8 @@ # Copyright 2012 - 2013 Daniel Borkmann # Subject to the GNU GPL, version 2. +include Config + VERSION = 0 PATCHLEVEL = 5 SUBLEVEL = 8 @@ -203,6 +205,7 @@ install_all: $(foreach tool,$(TOOLS),$(tool)_install) install_allbutcurvetun: $(foreach tool,$(filter-out curvetun,$(TOOLS)),$(tool)_install) install_allbutmausezahn: $(foreach tool,$(filter-out mausezahn,$(TOOLS)),$(tool)_install) clean mostlyclean: $(foreach tool,$(TOOLS),$(tool)_clean) + $(Q)$(call RM,Config) realclean distclean clobber: $(foreach tool,$(TOOLS),$(tool)_distclean) $(Q)$(call RMDIR,$(ETCDIRE)) mrproper: clean distclean -- cgit v1.2.3-54-g00ecf From 7199a4fe1d6f66722158d73d4403f8dad8637bd1 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 28 Jun 2013 14:28:06 +0200 Subject: configure: Check for presence of pkg-config and ccache binaries Check whether pkg-config and ccache are in the PATH. A missing pkg-config will cause the configure script to abort with an error. The presence of ccache is written to Config and used by the Makefile to conditionally make use of it. Signed-off-by: Tobias Klauser --- Makefile | 2 +- configure | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ee03d86..9ad9db5 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ TOOLS ?= netsniff-ng trafgen astraceroute flowtop ifpps bpfc curvetun mausezahn PREFIX ?= # Disable if you don't want it -CCACHE ?= ccache +CCACHE ?= $(CONFIG_CCACHE) # Location of installation paths. SBINDIR = $(PREFIX)/usr/sbin diff --git a/configure b/configure index ed1eacd..fd8211e 100755 --- a/configure +++ b/configure @@ -1,6 +1,7 @@ #!/bin/bash # This isn't a configure generated by autoconf! +MISSING_PKG_CONFIG=0 MISSING_DEFS=0 MISSING_NACL=0 @@ -9,6 +10,31 @@ MISSING_NACL=0 TMPDIR=$(mktemp -d config.XXXXXX) trap 'status=$?; rm -rf $TMPDIR; exit $status' EXIT HUP INT QUIT TERM +check_pkg_config() +{ + echo -n "[*] Checking pkg-config ... " + + if [ "x$(which pkg-config)" == "x" ] ; then + echo "[NO]" + MISSING_PKG_CONFIG=1 + else + echo "[YES]" + fi +} + +check_ccache() +{ + echo -n "[*] Checking ccache ... " + + if [ "x$(which ccache)" == "x" ] ; then + echo "[NO]" + echo "CONFIG_CCACHE=" >> Config + else + echo "[YES]" + echo "CONFIG_CCACHE=ccache" >> Config + fi +} + check_nacl() { echo -n "[*] Checking nacl ... " @@ -172,6 +198,14 @@ EOF } echo "# This file is autogenerated by the configure script" > Config +check_pkg_config + +if [ "$MISSING_PKG_CONFIG" == "1" ] ; then + echo "[!] pkg-config is not installed on your system or not in the PATH" + exit 1 +fi + +check_ccache check_nacl check_libnl check_tpacket -- cgit v1.2.3-54-g00ecf