Fix problems with the library build
diff --git a/configure.sh b/configure.sh
index 18f5fba..d304aaf 100755
--- a/configure.sh
+++ b/configure.sh
@@ -826,7 +826,11 @@
 
 fi
 
-if [ "$extra_math" -eq 1 ] && [ "$bc" -ne 0 ]; then
+if [ "$library" -eq 1 ]; then
+	bc_lib=""
+fi
+
+if [ "$extra_math" -eq 1 ] && [ "$bc" -ne 0 ] && [ "$library" -eq 0 ]; then
 	BC_LIB2_O="\$(GEN_DIR)/lib2.o"
 else
 	BC_LIB2_O=""
@@ -887,7 +891,10 @@
 fi
 
 if [ "$library" -eq 1 ]; then
-	unneeded="$unneeded args.c file.c main.c bc.c dc.c opt.c read.c"
+	unneeded="$unneeded args.c opt.c read.c file.c main.c"
+	unneeded="$unneeded lang.c lex.c parse.c program.c"
+	unneeded="$unneeded bc.c bc_lex.c bc_parse.c"
+	unneeded="$unneeded dc.c dc_lex.c dc_parse.c"
 fi
 
 # Print out the values; this is for debugging.
@@ -938,7 +945,7 @@
 contents=$(replace "$contents" "$needle" "$replacement")
 
 if [ "$unneeded" = "" ]; then
-	contents=$(gen_file_list "$contents")
+	contents=$(gen_file_list "$contents" "library.c")
 else
 	contents=$(gen_file_list "$contents" $unneeded)
 fi