Index: setup/build.py
--- setup/build.py.orig
+++ setup/build.py
@@ -256,8 +256,8 @@ def init_env(debug=False, sanitize=False, compiling_fo
     platform_name = 'linux'
     dest_ext = '.so'
     if isunix:
-        cc = os.environ.get('CC', 'gcc')
-        cxx = os.environ.get('CXX', 'g++')
+        cc = os.environ.get('CC', '${CC}')
+        cxx = os.environ.get('CXX', '${CXX}')
         debug = '-ggdb' if debug else ''
         cflags = os.environ.get('OVERRIDE_CFLAGS',
             f'-Wall -DNDEBUG {debug} -fno-strict-aliasing -pipe -O3')
@@ -283,6 +283,8 @@ def init_env(debug=False, sanitize=False, compiling_fo
     if isbsd:
         cflags.append('-pthread')
         ldflags.append('-shared')
+        cflags.append('-I${PREFIX}/include')
+        ldflags.append('-L${PREFIX}/lib')
 
     if ishaiku:
         cflags.append('-lpthread')
