--- configure.orig
+++ configure
@@ -6,9 +6,9 @@
 #define _CONFIG_H
 EOF
 
-echo -n 'Checking for libfftw3f...'
+printf 'Checking for libfftw3f... '
 
-gcc -o test-fft -Wall -x c -lfftw3f -I/usr/local/include -L/usr/local/lib - <<'EOF'
+gcc -o test-fft -Wall -x c -lfftw3f -I"${PREFIX:-/usr/local}/include" -L"${PREFIX:-/usr/local}/lib" - <<'EOF'
 #include <fftw3.h>
 
 #define N 128
@@ -31,12 +31,12 @@
 
 if ./test-fft
 then
-	echo OK
-	echo '#define _FFTW3' >> config.h
-	echo 'export FFTW3=1' >> config.mak
+	printf 'OK\n'
+	printf '#define _FFTW3\n' >> config.h
+	printf 'export FFTW3=1\n' >> config.mak
 fi
 
-echo -n 'Detecting endianness...'
+printf 'Detecting endianness... '
 
 gcc -o test-endian -Wall -x c - <<'EOF'
 #include <stdint.h>
@@ -63,17 +63,19 @@
 if ./test-endian > /dev/null
 then
 	ENDIAN=$(./test-endian)
-	if [ $ENDIAN = EL ]
-	then
-		echo 'Little Endian'
-		echo '#define _EL_ARCH' >> config.h
-	elif [ $ENDIAN = BE ]
-	then
-		echo 'Big Endian'
-		echo '#define _BE_ARCH' >> config.h
-	fi
+	case ${ENDIAN}
+	in
+		(EL)
+			printf 'Little Endian\n'
+			printf '#define _EL_ARCH\n' >> config.h
+			;;
+		(BE)
+			printf 'Big Endian\n'
+			printf '#define _BE_ARCH\n' >> config.h
+			;;
+	esac
 fi
 
-echo '#endif' >> config.h
+printf '#endif\n' >> config.h
 
-echo 'Now run make'
+# printf 'Now run make\n'
