--- a/src/compile.lsp.in
+++ b/src/compile.lsp.in
@@ -1,3 +1,4 @@
+;;; @configure_input@
 ;;;
 ;;; This is the "makefile" file for building ECL. The purpose of this file is
 ;;;	- Compile the core of the Common-Lisp library (lsp, clos)
@@ -36,7 +37,7 @@
 ;;;   with an already installed copy of ECL.
 ;;;
 (setq c::*cc-flags*
-      #-msvc "@CFLAGS@ @ECL_CFLAGS@ -I\"@true_srcdir@\"/h -I\"@true_srcdir@\"/gmp -I\"@true_builddir@\"/h"
+      #-msvc "@CPPFLAGS@ @CFLAGS@ @ECL_CFLAGS@ -I\"@true_srcdir@\"/h -I\"@true_srcdir@\"/gmp -I\"@true_builddir@\"/h"
       #+msvc "@CFLAGS@ @ECL_CFLAGS@ -I\"@true_srcdir@\"/h -I\"@true_builddir@\"/h"
       c::*cc-format*
       #-msvc "~A ~A ~:[~*~;~A~] -I\"@true_builddir@\"/h~* -w -c ~S -o ~S"
@@ -46,14 +47,14 @@
       #+msvc "~A -Zi -Fe~S~* ~{~S ~} ~@?")
 #-dlopen 
 (setf c::*ld-flags*
-      "@LDFLAGS@ @LDRPATH@ @LIBPREFIX@ecl.@LIBEXT@ @STATICLIBS@ @CLIBS@")
+      "@LDFLAGS@ @LDRPATH@ @LIBPREFIX@ecl.@LIBEXT@ @CORE_LIBS@ @LIBS@ @FASL_LIBS@")
 #+dlopen
 (setf c::*ld-flags*
-      "@LDFLAGS@ @LDRPATH@ @SHAREDPREFIX@ecl.@SHAREDEXT@ @CLIBS@"
+      "@LDFLAGS@ @LDRPATH@ @SHAREDPREFIX@ecl.@SHAREDEXT@ @LIBS@"
       c::*ld-shared-flags*
-      "@LDRPATH@ @SHARED_LDFLAGS@ @LDFLAGS@ @SHAREDPREFIX@ecl.@SHAREDEXT@ @CLIBS@"
+      "@LDRPATH@ @SHARED_LDFLAGS@ @LDFLAGS@ @SHAREDPREFIX@ecl.@SHAREDEXT@ @LIBS@ @FASL_LIBS@"
       c::*ld-bundle-flags*
-      "@LDRPATH@ @BUNDLE_LDFLAGS@ @LDFLAGS@ @SHAREDPREFIX@ecl.@SHAREDEXT@ @CLIBS@")
+      "@LDRPATH@ @BUNDLE_LDFLAGS@ @LDFLAGS@ @SHAREDPREFIX@ecl.@SHAREDEXT@ @LIBS@ @FASL_LIBS@")
 
 ;;;
 ;;; * Avoid name clashes with user supplied code.
@@ -88,13 +89,13 @@
 cd tmp; ar -x ../@LIBPREFIX@lsp.@LIBEXT@;
 for i in *.@OBJEXT@; do mv $i lsp_`basename $i`; done;
 ar -r ../@LIBPREFIX@ecl.@LIBEXT@ *.@OBJEXT@ ../c/all_symbols2.@OBJEXT@; rm *.@OBJEXT@;
-ranlib ../@LIBPREFIX@ecl.@LIBEXT@'")
+@RANLIB@ ../@LIBPREFIX@ecl.@LIBEXT@'")
 
 #+dlopen
 ;;;
 ;;; We do not need the -rpath flag for the library, nor -lecl.
 ;;;
-(let ((c::*ld-shared-flags* #-msvc "@SHARED_LDFLAGS@ @LDFLAGS@ @STATICLIBS@ @CLIBS@"
+(let ((c::*ld-shared-flags* #-msvc "@SHARED_LDFLAGS@ @LDFLAGS@ @CORE_LIBS@ @LIBS@ @FASL_LIBS@"
 			    #+msvc "@SHARED_LDFLAGS@ @LDFLAGS@ @STATICLIBS@ @CLIBS@ /DEF:@DEF@")
       (c::*cc-flags* (concatenate 'string "-I@true_builddir@/c " c::*cc-flags*)))
   (c::shared-cc (compile-file-pathname "ecl" :type :dll)