REQ-RPM-PKG-NAMES	+= protobuf
REQ-RPM-PKG-NAMES	+= protobuf-c
REQ-RPM-PKG-NAMES	+= protobuf-c-devel
REQ-RPM-PKG-NAMES	+= protobuf-compiler
REQ-RPM-PKG-NAMES	+= protobuf-devel
REQ-RPM-PKG-NAMES	+= protobuf-python
REQ-RPM-PKG-NAMES	+= libnl3-devel
REQ-RPM-PKG-NAMES	+= libcap-devel
REQ-RPM-PKG-NAMES	+= $(PYTHON)-future

REQ-RPM-PKG-TEST-NAMES  += libaio-devel

REQ-DEB-PKG-NAMES	+= libprotobuf-dev
REQ-DEB-PKG-NAMES	+= libprotobuf-c0-dev
REQ-DEB-PKG-NAMES	+= protobuf-c-compiler
REQ-DEB-PKG-NAMES	+= protobuf-compiler
REQ-DEB-PKG-NAMES	+= python-protobuf
REQ-DEB-PKG-NAMES	+= libnl-3-dev
REQ-DEB-PKG-NAMES	+= libcap-dev

REQ-DEB-PKG-TEST-NAMES	+= python-yaml
REQ-DEB-PKG-TEST-NAMES	+= libaio-dev

ifeq ($(PYTHON),python3)
REQ-DEB-PKG-NAMES	+= $(PYTHON)-future
REQ-DEB-PKG-TEST-NAMES	+= libaio-dev

REQ-RPM-PKG-TEST-NAMES	+= $(PYTHON)-PyYAML
else
REQ-DEB-PKG-NAMES	+= python-future

REQ-RPM-PKG-TEST-NAMES	+= $(PYTHON)-pyyaml
endif

export LIBS		+= -lrt -lpthread -lprotobuf-c -ldl -lnl-3 -lsoccr -Lsoccr/ -lnet

check-packages-failed:
	$(warning Can not find some of the required libraries)
	$(warning Make sure the following packages are installed)
	$(warning RPM based distros: $(REQ-RPM-PKG-NAMES))
	$(warning DEB based distros: $(REQ-DEB-PKG-NAMES))
	$(warning To run tests the following packages are needed)
	$(warning RPM based distros: $(REQ-RPM-PKG-TEST-NAMES))
	$(warning DEB based distros: $(REQ-DEB-PKG-TEST-NAMES))
	$(error Compilation aborted)

#
# Make sure all required libs are installed
PROGRAM_STUB := int main(int argc, char **argv) { return 0; }
check-packages:
	$(Q) $(call try-cc,$(PROGRAM_STUB),$(LIBS)) \
		|| $(MAKE) -f $(obj)/Makefile.packages check-packages-failed
.PHONY: check-packages-failed check-packages
