--- a/Makefile.in
+++ b/Makefile.in
@@ -4,7 +4,8 @@ LIBTCL = -ltcl8.4
 CC = @CC@
 CPP = @CPP@
 CFLAGS = @CFLAGS@
-CPPFLAGS = -D_GNU_SOURCE -I/usr/include/slang @CPPFLAGS@ 
+AR ?= ar
+CPPFLAGS = -D_GNU_SOURCE @CPPFLAGS@
 
 SHLIBFLAGS= -Wl,--version-script,newt.0.52.ver
 VERSION = @VERSION@
@@ -53,19 +54,19 @@ endif
 all:	$(TARGET) _snackmodule.so
 
 test:	test.o $(LIBNEWT)
-	$(CC) -g -o test test.o $(LIBNEWT) $(LIBS)
+	$(CC) $(CFLAGS) -g -o test test.o $(LIBNEWT) $(LIBS)
 
 testgrid:	testgrid.o $(LIBNEWT)
-	$(CC) -g -o testgrid testgrid.o $(LIBNEWT) $(LIBS)
+	$(CC) $(CFLAGS) -g -o testgrid testgrid.o $(LIBNEWT) $(LIBS)
 
 testtree:	testtree.o $(LIBNEWT)
-	$(CC) -g -o testtree testtree.o $(LIBNEWT) $(LIBS)
+	$(CC) $(CFLAGS) -g -o testtree testtree.o $(LIBNEWT) $(LIBS)
 
 showchars:	showchars.o $(LIBNEWT)
-	$(CC) -g -o showchars showchars.o $(LIBNEWT) $(LIBS)
+	$(CC) $(CFLAGS) -g -o showchars showchars.o $(LIBNEWT) $(LIBS)
 
 showkey:	showkey.o $(LIBNEWT)
-	$(CC) -g -o showkey showkey.o $(LIBNEWT) $(LIBS)
+	$(CC) $(CFLAGS) -g -o showkey showkey.o $(LIBNEWT) $(LIBS)
 
 _snackmodule.so:   snackmodule.c $(LIBNEWTSH)
 	for ver in $(PYTHONVERS) ; do \
@@ -76,13 +77,13 @@ _snackmodule.so:   snackmodule.c $(LIBNE
 	touch $@
 
 whiptail: $(NDIALOGOBJS) $(LIBNEWTSH)
-	$(CC) -g -o whiptail $(NDIALOGOBJS) -L . -lnewt $(LIBS) -lpopt
+	$(CC) $(CFLAGS) -g -o whiptail $(NDIALOGOBJS) -L . -lnewt $(LIBS) -lpopt
 
 whiptcl.so: $(WHIPTCLOBJS) $(LIBNEWTSH)
 	$(CC) -shared $(SHCFLAGS) -o whiptcl.so $(WHIPTCLOBJS) -L . -lnewt  $(LIBTCL) -lpopt
 
 $(LIBNEWT): $(LIBOBJS)
-	ar rv $@ $^
+	$(AR) rv $@ $^
 
 newt.o $(SHAREDDIR)/newt.o: newt.c Makefile
 
@@ -102,12 +103,12 @@ $(SHAREDDIR):
 sharedlib: $(LIBNEWTSH)
 
 $(LIBNEWTSH): $(SHAREDDIR) $(SHAREDOBJS)
-	$(CC) -shared -o $(LIBNEWTSH) $(SHLIBFLAGS) -Wl,-soname,$(LIBNEWTSONAME) $(SHAREDOBJS) $(LIBS)
+	$(CC) $(CFLAGS) -shared -o $(LIBNEWTSH) $(SHLIBFLAGS) -Wl,-soname,$(LIBNEWTSONAME) $(SHAREDOBJS) $(LIBS)
 	ln -fs $(LIBNEWTSONAME) libnewt.so
 	ln -fs $(LIBNEWTSH) $(LIBNEWTSONAME)
 
 $(SHAREDDIR)/%.o : %.c
-	$(CC) $(SHCFLAGS) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
+	$(CC) $(CFLAGS) $(SHCFLAGS) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
 
 install: $(LIBNEWT) install-sh whiptail
 	[ -d $(instroot)/$(bindir) ] || install -m 755 -d $(instroot)/$(bindir)