--- a/Makefile.in
+++ b/Makefile.in
@@ -7,12 +7,6 @@ SCRIPTS=bon_csv2txt
 
 prefix=@prefix@
 eprefix=@exec_prefix@
-#MORE_WARNINGS=-Weffc++
-WFLAGS=-Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -Wcast-align -Wsign-compare -Wpointer-arith -Wwrite-strings -Wformat-security -Wswitch-enum -Winit-self $(MORE_WARNINGS)
-CFLAGS=-O2 @debug@ -DNDEBUG $(WFLAGS) $(MORECFLAGS)
-CXX=@CXX@ $(CFLAGS)
-LINK=@CXX@
-THREAD_LFLAGS=@thread_ldflags@
 
 INSTALL=@INSTALL@
 INSTALL_PROGRAM=@INSTALL_PROGRAM@
@@ -34,22 +28,22 @@ GETCHSRC=getc_putc_helper.cpp duration.cpp
 GETCHOBJS=$(GETCHSRC:.cpp=.o)
 
 bonnie++: $(BONOBJS)
-	$(LINK) -o bonnie++ $(BONOBJS) $(THREAD_LFLAGS)
+	$(CXX) $(CXXFLAGS) -o bonnie++ $(BONOBJS)
 
 zcav: $(ZCAVOBJS)
-	$(LINK) -o zcav $(ZCAVOBJS) $(THREAD_LFLAGS)
+	$(CXX) $(CXXFLAGS) -o zcav $(ZCAVOBJS)
 
 getc_putc: $(GETCOBJS) getc_putc_helper
-	$(LINK) -o getc_putc $(GETCOBJS) $(THREAD_LFLAGS)
+	$(CXX) $(CXXFLAGS) -o getc_putc $(GETCOBJS)
 
 getc_putc_helper: $(GETCHOBJS)
-	$(CXX) -o getc_putc_helper $(GETCHOBJS)
+	$(CXX) $(CXXFLAGS) -o getc_putc_helper $(GETCHOBJS)
 
 bon_csv2html: bon_csv2html.o
-	$(LINK) bon_csv2html.o -o bon_csv2html
+	$(CXX) $(CXXFLAGS) bon_csv2html.o -o bon_csv2html
 
 generate_randfile: generate_randfile.o
-	$(LINK) generate_randfile.o -o generate_randfile
+	$(CXX) $(CXXFLAGS) generate_randfile.o -o generate_randfile
 
 install-bin: $(EXE) $(EXES)
 	mkdir -p $(eprefix)/bin $(eprefix)/sbin
@@ -63,7 +57,7 @@ install: install-bin
 	@INSTALL_DATA@ $(MAN8) @mandir@/man8
 
 %.o: %.cpp
-	$(CXX) -c $<
+	$(CXX) $(CXXFLAGS) -c $<
 
 clean:
 	rm -f $(EXE) $(EXES) *.o build-stamp install-stamp
--- a/configure.in
+++ b/configure.in
@@ -31,7 +31,6 @@ fi
 
 dnl Checks for programs.
 AC_LANG_CPLUSPLUS
-AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_CXXCPP
 AC_PROG_INSTALL
@@ -66,7 +65,7 @@ AC_SUBST(linux_pthread)
 AC_TRY_COMPILE([#define _GNU_SOURCE
 #include <pthread.h>
 ] , [pthread_mutexattr_t attr;
-    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);]
+    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);]
   , linux_pthread="yes")
 if [[ -n "$linux_pthread" ]]; then
    linux_pthread="#define LINUX_PTHREAD"
@@ -83,7 +82,7 @@ void * thread_func(void * param) { return NULL; }
   , thread_ldflags="-pthread")
 
 AC_SUBST(large_file)
-AC_TRY_RUN([#ifndef _LARGEFILE64_SOURCE
+AC_TRY_COMPILE([#ifndef _LARGEFILE64_SOURCE
 #define _LARGEFILE64_SOURCE
 #endif
 #include <stdio.h>
