From 2ed6878412d54ad1a6509de45d6351a3f697bb48 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 4 Aug 2015 23:13:43 +0200 Subject: [PATCH] Fixing environments where pkg-config isn't installed. Depending on the presence of pkg-config, we're not necessarily doing the right thing in the Makefile. Zlib is a pkg-config dependency, but libm, libpthread, librt aren't. --- Makefile | 62 ++++++++++++++++++++++++------------- templates/Makefile.template | 62 ++++++++++++++++++++++++------------- 2 files changed, 82 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index 8a38a689f99..4ad466dae85 100644 --- a/Makefile +++ b/Makefile @@ -268,34 +268,21 @@ INCLUDES = . include $(GENDIR) LDFLAGS += -Llibs/$(CONFIG) ifeq ($(SYSTEM),Darwin) -ifneq ($(wildcard /usr/local/ssl/include),) -INCLUDES += /usr/local/ssl/include -endif -ifneq ($(wildcard /opt/local/include),) -INCLUDES += /opt/local/include -endif -ifneq ($(wildcard /usr/local/include),) -INCLUDES += /usr/local/include -endif -LIBS = m z -ifneq ($(wildcard /usr/local/ssl/lib),) -LDFLAGS += -L/usr/local/ssl/lib -endif -ifneq ($(wildcard /opt/local/lib),) -LDFLAGS += -L/opt/local/lib -endif -ifneq ($(wildcard /usr/local/lib),) -LDFLAGS += -L/usr/local/lib -endif +LIBS += m endif ifeq ($(SYSTEM),Linux) -LIBS = rt m z pthread +LIBS += rt m pthread LDFLAGS += -pthread endif ifeq ($(SYSTEM),MINGW32) -LIBS = m z pthread +LIBS += m pthread +LDFLAGS += -pthread +endif + +ifeq ($(SYSTEM),FreeBSD) +LIBS += pthread LDFLAGS += -pthread endif @@ -387,6 +374,39 @@ ZLIB_CHECK_CMD = $(PKG_CONFIG) --exists zlib PROTOBUF_CHECK_CMD = $(PKG_CONFIG) --atleast-version=3.0.0-alpha-3 protobuf else # HAS_PKG_CONFIG +ifeq ($(SYSTEM),Darwin) +ifneq ($(wildcard /usr/local/ssl/include),) +INCLUDES += /usr/local/ssl/include +endif +ifneq ($(wildcard /opt/local/include),) +INCLUDES += /opt/local/include +endif +ifneq ($(wildcard /usr/local/include),) +INCLUDES += /usr/local/include +endif +ifneq ($(wildcard /usr/local/ssl/lib),) +LDFLAGS += -L/usr/local/ssl/lib +endif +ifneq ($(wildcard /opt/local/lib),) +LDFLAGS += -L/opt/local/lib +endif +ifneq ($(wildcard /usr/local/lib),) +LDFLAGS += -L/usr/local/lib +endif +endif + +ifeq ($(SYSTEM),Linux) +LIBS += z +endif + +ifeq ($(SYSTEM),MINGW32) +LIBS += z +endif + +ifeq ($(SYSTEM),FreeBSD) +LIBS += z +endif + ifeq ($(SYSTEM),MINGW32) OPENSSL_LIBS = ssl32 eay32 else diff --git a/templates/Makefile.template b/templates/Makefile.template index 1e46db11dce..1883bd6c2f8 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -282,34 +282,21 @@ INCLUDES = . include $(GENDIR) LDFLAGS += -Llibs/$(CONFIG) ifeq ($(SYSTEM),Darwin) -ifneq ($(wildcard /usr/local/ssl/include),) -INCLUDES += /usr/local/ssl/include -endif -ifneq ($(wildcard /opt/local/include),) -INCLUDES += /opt/local/include -endif -ifneq ($(wildcard /usr/local/include),) -INCLUDES += /usr/local/include -endif -LIBS = m z -ifneq ($(wildcard /usr/local/ssl/lib),) -LDFLAGS += -L/usr/local/ssl/lib -endif -ifneq ($(wildcard /opt/local/lib),) -LDFLAGS += -L/opt/local/lib -endif -ifneq ($(wildcard /usr/local/lib),) -LDFLAGS += -L/usr/local/lib -endif +LIBS += m endif ifeq ($(SYSTEM),Linux) -LIBS = rt m z pthread +LIBS += rt m pthread LDFLAGS += -pthread endif ifeq ($(SYSTEM),MINGW32) -LIBS = m z pthread +LIBS += m pthread +LDFLAGS += -pthread +endif + +ifeq ($(SYSTEM),FreeBSD) +LIBS += pthread LDFLAGS += -pthread endif @@ -412,6 +399,39 @@ ZLIB_CHECK_CMD = $(PKG_CONFIG) --exists zlib PROTOBUF_CHECK_CMD = $(PKG_CONFIG) --atleast-version=3.0.0-alpha-3 protobuf else # HAS_PKG_CONFIG +ifeq ($(SYSTEM),Darwin) +ifneq ($(wildcard /usr/local/ssl/include),) +INCLUDES += /usr/local/ssl/include +endif +ifneq ($(wildcard /opt/local/include),) +INCLUDES += /opt/local/include +endif +ifneq ($(wildcard /usr/local/include),) +INCLUDES += /usr/local/include +endif +ifneq ($(wildcard /usr/local/ssl/lib),) +LDFLAGS += -L/usr/local/ssl/lib +endif +ifneq ($(wildcard /opt/local/lib),) +LDFLAGS += -L/opt/local/lib +endif +ifneq ($(wildcard /usr/local/lib),) +LDFLAGS += -L/usr/local/lib +endif +endif + +ifeq ($(SYSTEM),Linux) +LIBS += z +endif + +ifeq ($(SYSTEM),MINGW32) +LIBS += z +endif + +ifeq ($(SYSTEM),FreeBSD) +LIBS += z +endif + ifeq ($(SYSTEM),MINGW32) OPENSSL_LIBS = ssl32 eay32 else