diff --git a/makefiles/Makefile.unix b/makefiles/Makefile.unix index 717e2831f10..003352cc1ae 100755 --- a/makefiles/Makefile.unix +++ b/makefiles/Makefile.unix @@ -41,10 +41,16 @@ FZ_EXE = fzn-or-tools$E # This is needed to find python.h PYTHON_VERSION = $(UNIX_PYTHON_VER) -PATH_TO_PYTHON_INCLUDE = $(shell python$(UNIX_PYTHON_VER) -c 'import sysconfig; print (sysconfig.get_paths()["platinclude"])') + PATH_TO_PYTHON_LIB = $(shell python$(UNIX_PYTHON_VER) -c 'import sysconfig; print (sysconfig.get_paths()["stdlib"])') +PATH_TO_PYTHON_INCLUDE = $(shell python$(UNIX_PYTHON_VER) -c 'import sysconfig; print (sysconfig.get_paths()["platinclude"])') + PYTHON_INC = -I$(PATH_TO_PYTHON_INCLUDE) -I$(PATH_TO_PYTHON_LIB) $(ADD_PYTHON_INC) +ifeq ($(PLATFORM),LINUX) +MAJOR_PYTHON_VERSION = $(shell python$(UNIX_PYTHON_VER) -c "from sys import version_info as v; print (str(v[0]))") +PYTHON_INC += $(shell pkg-config --cflags --libs python$(MAJOR_PYTHON_VERSION) 2> /dev/null) +endif # This is needed to find gflags/gflags.h GFLAGS_INC = -I$(UNIX_GFLAGS_DIR)/include