--- Makefile.in
+++ Makefile.in
@@ -168,10 +168,10 @@ pth_p.h: $(S)pth_p.h.in
 
 #   build the static and possibly shared libraries
 libpth.la: $(LOBJS)
-	$(LIBTOOL) --mode=link --quiet $(CC) -o libpth.la $(LOBJS) \
+	$(LIBTOOL) --mode=link --quiet $(CC) $(CFLAGS) $(LDFLAGS) -o libpth.la $(LOBJS) \
 	-rpath $(libdir) -version-info `$(SHTOOL) version -lc -dlibtool $(_VERSION_FILE)`
 libpthread.la: pthread.lo $(LOBJS)
-	$(LIBTOOL) --mode=link --quiet $(CC) -o libpthread.la pthread.lo $(LOBJS) \
+	$(LIBTOOL) --mode=link --quiet $(CC) $(CFLAGS) $(LDFLAGS) -o libpthread.la pthread.lo $(LOBJS) \
 	-rpath $(libdir) -version-info `$(SHTOOL) version -lc -dlibtool $(_VERSION_FILE)`
 
 #   build the manual pages
@@ -194,25 +194,25 @@ $(S)pthread.3: $(S)pthread.pod $(_VERSION_FILE)
 
 #   build test program
 test_std: test_std.o test_common.o libpth.la
-	$(LIBTOOL) --mode=link --quiet $(CC) $(LDFLAGS) -o test_std test_std.o test_common.o libpth.la $(LIBS)
+	$(LIBTOOL) --mode=link --quiet $(CC) $(CFLAGS) $(LDFLAGS) -o test_std test_std.o test_common.o libpth.la $(LIBS)
 test_httpd: test_httpd.o test_common.o libpth.la
-	$(LIBTOOL) --mode=link --quiet $(CC) $(LDFLAGS) -o test_httpd test_httpd.o test_common.o libpth.la $(LIBS)
+	$(LIBTOOL) --mode=link --quiet $(CC) $(CFLAGS) $(LDFLAGS) -o test_httpd test_httpd.o test_common.o libpth.la $(LIBS)
 test_misc: test_misc.o test_common.o libpth.la
-	$(LIBTOOL) --mode=link --quiet $(CC) $(LDFLAGS) -o test_misc test_misc.o test_common.o libpth.la $(LIBS)
+	$(LIBTOOL) --mode=link --quiet $(CC) $(CFLAGS) $(LDFLAGS) -o test_misc test_misc.o test_common.o libpth.la $(LIBS)
 test_mp: test_mp.o test_common.o libpth.la
-	$(LIBTOOL) --mode=link --quiet $(CC) $(LDFLAGS) -o test_mp test_mp.o test_common.o libpth.la $(LIBS)
+	$(LIBTOOL) --mode=link --quiet $(CC) $(CFLAGS) $(LDFLAGS) -o test_mp test_mp.o test_common.o libpth.la $(LIBS)
 test_philo: test_philo.o test_common.o libpth.la
-	$(LIBTOOL) --mode=link --quiet $(CC) $(LDFLAGS) -o test_philo test_philo.o test_common.o libpth.la $(LIBS)
+	$(LIBTOOL) --mode=link --quiet $(CC) $(CFLAGS) $(LDFLAGS) -o test_philo test_philo.o test_common.o libpth.la $(LIBS)
 test_sig: test_sig.o test_common.o libpth.la
-	$(LIBTOOL) --mode=link --quiet $(CC) $(LDFLAGS) -o test_sig test_sig.o test_common.o libpth.la $(LIBS)
+	$(LIBTOOL) --mode=link --quiet $(CC) $(CFLAGS) $(LDFLAGS) -o test_sig test_sig.o test_common.o libpth.la $(LIBS)
 test_select: test_select.o test_common.o libpth.la
-	$(LIBTOOL) --mode=link --quiet $(CC) $(LDFLAGS) -o test_select test_select.o test_common.o libpth.la $(LIBS)
+	$(LIBTOOL) --mode=link --quiet $(CC) $(CFLAGS) $(LDFLAGS) -o test_select test_select.o test_common.o libpth.la $(LIBS)
 test_sfio: test_sfio.o test_common.o libpth.la
-	$(LIBTOOL) --mode=link --quiet $(CC) $(LDFLAGS) -o test_sfio test_sfio.o test_common.o libpth.la $(LIBS)
+	$(LIBTOOL) --mode=link --quiet $(CC) $(CFLAGS) $(LDFLAGS) -o test_sfio test_sfio.o test_common.o libpth.la $(LIBS)
 test_uctx: test_uctx.o test_common.o libpth.la
-	$(LIBTOOL) --mode=link --quiet $(CC) $(LDFLAGS) -o test_uctx test_uctx.o test_common.o libpth.la $(LIBS)
+	$(LIBTOOL) --mode=link --quiet $(CC) $(CFLAGS) $(LDFLAGS) -o test_uctx test_uctx.o test_common.o libpth.la $(LIBS)
 test_pthread: test_pthread.o test_common.o libpthread.la
-	$(LIBTOOL) --mode=link --quiet $(CC) $(LDFLAGS) -o test_pthread test_pthread.o test_common.o libpthread.la $(LIBS)
+	$(LIBTOOL) --mode=link --quiet $(CC) $(CFLAGS) $(LDFLAGS) -o test_pthread test_pthread.o test_common.o libpthread.la $(LIBS)
 
 #   install the package
 install: all-for-install