diff --git a/src/makefile b/src/makefile
index adf687f..c2abddc 100644
--- a/src/makefile
+++ b/src/makefile
@@ -160,6 +160,8 @@ SOCKET_macosx=usocket.o
 #------
 # Compiler and linker settings
 # for Linux
+LUAPC=lua
+LUA_CFLAGS=$(shell pkg-config --cflags $(LUAPC))
 SO_linux=so
 O_linux=o
 CC_linux=gcc
@@ -167,7 +169,7 @@ DEF_linux=-DLUASOCKET_$(DEBUG) \
 	-DLUASOCKET_API='__attribute__((visibility("default")))' \
 	-DUNIX_API='__attribute__((visibility("default")))' \
 	-DMIME_API='__attribute__((visibility("default")))'
-CFLAGS_linux= -I$(LUAINC) $(DEF) -Wall -Wshadow -Wextra \
+CFLAGS_linux= $(LUA_CFLAGS) -I$(LUAINC) $(DEF) -Wall -Wshadow -Wextra \
 	-Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden
 LDFLAGS_linux=-O -shared -fpic -o 
 LD_linux=gcc