Added support for newer clang compilers on OSX and more flexible cases for libpcap components built from www.tcpdump.org source code

This commit is contained in:
Mark Pizzolato 2013-03-13 17:29:42 -07:00
parent 3dea6056e6
commit f179ba6ae2

View file

@ -71,9 +71,13 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
OSTYPE = cygwin OSTYPE = cygwin
OSNAME = windows-build OSNAME = windows-build
endif endif
ifeq (,$(shell $(GCC) -v /dev/null 2>&1 | grep 'clang version')) ifeq (,$(shell $(GCC) -v /dev/null 2>&1 | grep 'clang'))
GCC_VERSION = $(shell $(GCC) -v /dev/null 2>&1 | grep 'gcc version' | awk '{ print $$3 }') GCC_VERSION = $(shell $(GCC) -v /dev/null 2>&1 | grep 'gcc version' | awk '{ print $$3 }')
COMPILER_NAME = GCC Version: $(GCC_VERSION) COMPILER_NAME = GCC Version: $(GCC_VERSION)
else
ifeq (Apple,$(shell $(GCC) -v /dev/null 2>&1 | grep 'Apple' | awk '{ print $$1 }'))
COMPILER_NAME = $(shell $(GCC) -v /dev/null 2>&1 | grep 'Apple' | awk '{ print $$1 " " $$2 " " $$3 " " $$4 }')
CLANG_VERSION = $(word 4,$(COMPILER_NAME))
else else
COMPILER_NAME = $(shell $(GCC) -v /dev/null 2>&1 | grep 'clang version' | awk '{ print $$1 " " $$2 " " $$3 }') COMPILER_NAME = $(shell $(GCC) -v /dev/null 2>&1 | grep 'clang version' | awk '{ print $$1 " " $$2 " " $$3 }')
CLANG_VERSION = $(word 3,$(COMPILER_NAME)) CLANG_VERSION = $(word 3,$(COMPILER_NAME))
@ -82,6 +86,7 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
CLANG_VERSION = $(word 4,$(COMPILER_NAME)) CLANG_VERSION = $(word 4,$(COMPILER_NAME))
endif endif
endif endif
endif
LTO_EXCLUDE_VERSIONS = LTO_EXCLUDE_VERSIONS =
PCAPLIB = pcap PCAPLIB = pcap
ifeq (agcc,$(findstring agcc,$(GCC))) # Android target build? ifeq (agcc,$(findstring agcc,$(GCC))) # Android target build?
@ -231,12 +236,18 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
endif endif
else else
# Look for package built from tcpdump.org sources with default install target (or cygwin winpcap) # Look for package built from tcpdump.org sources with default install target (or cygwin winpcap)
LIBPATH += /usr/local/lib
INCPATH += /usr/local/include INCPATH += /usr/local/include
ifneq (,$(call find_include,pcap))
LIBEXTSAVE := $(LIBEXT) LIBEXTSAVE := $(LIBEXT)
# first check if binary - shared objects are available/installed in the linker known search paths
ifneq (,$(call find_lib,$(PCAPLIB)))
NETWORK_CCDEFS = -DUSE_SHARED -I$(dir $(call find_include,pcap))
NETWORK_FEATURES = - dynamic networking support using libpcap components from www.tcpdump.org and locally installed libpcap.$(LIBEXT)
$(info using libpcap: $(call find_include,pcap))
else
LIBPATH += /usr/local/lib
LIBEXT = a LIBEXT = a
ifneq (,$(call find_lib,$(PCAPLIB))) ifneq (,$(call find_lib,$(PCAPLIB)))
ifneq (,$(call find_include,pcap))
$(info using libpcap: $(call find_lib,$(PCAPLIB)) $(call find_include,pcap)) $(info using libpcap: $(call find_lib,$(PCAPLIB)) $(call find_include,pcap))
ifeq (cygwin,$(OSTYPE)) ifeq (cygwin,$(OSTYPE))
NETWORK_CCDEFS = -DUSE_NETWORK -I$(dir $(call find_include,pcap)) NETWORK_CCDEFS = -DUSE_NETWORK -I$(dir $(call find_include,pcap))
@ -255,10 +266,13 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
$(info *** Warning ***) $(info *** Warning ***)
endif endif
else else
$(error using libpcap: $(call find_lib,$(PCAPLIB)) missing pcap.h) $(error using libpcap: $(call find_include,pcap) missing $(PCAPLIB).$(LIBEXT))
endif endif
endif endif
LIBEXT = $(LIBEXTSAVE) LIBEXT = $(LIBEXTSAVE)
else
$(error using libpcap: missing pcap.h)
endif
endif endif
ifneq (,$(findstring USE_NETWORK,$(NETWORK_CCDEFS))$(findstring USE_SHARED,$(NETWORK_CCDEFS))) ifneq (,$(findstring USE_NETWORK,$(NETWORK_CCDEFS))$(findstring USE_SHARED,$(NETWORK_CCDEFS)))
# Given we have libpcap components, consider other network connections as well # Given we have libpcap components, consider other network connections as well