diff --git a/src/CHANGELOG b/src/CHANGELOG index cc7099fa5..ead274d08 100755 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -49,6 +49,11 @@ ECL 10.1.1: - ECL now ships with ASDF version 1.596 + - The variables C:*USER-CC-FLAGS* and C:*USER-LD-FLAGS* are lists of strings + which can be customized by the user to change the behavior of the C compiler + and the linker. Note, however, that the flags that ECL uses may take + priority. + ;;; Local Variables: *** ;;; mode:text *** ;;; fill-column:79 *** diff --git a/src/cmp/cmpdefs.lsp b/src/cmp/cmpdefs.lsp index afa56fb1a..1d4aeeacd 100644 --- a/src/cmp/cmpdefs.lsp +++ b/src/cmp/cmpdefs.lsp @@ -23,6 +23,8 @@ "*COMPILE-VERBOSE*" "*CC*" "*CC-OPTIMIZE*" + "*USER-CC-FLAGS*" + "*USER-LD-FLAGS*" "BUILD-ECL" "BUILD-PROGRAM" "BUILD-FASL" @@ -453,11 +455,11 @@ coprocessor).") (defvar *cc-optimize* #-msvc "-O" #+msvc "@CFLAGS_OPTIMIZE@") -(defvar *ld-format* #-msvc "~A -o ~S -L~S ~{~S ~} ~@[~S~] ~A" - #+msvc "~A -Fe~S~* ~{~S ~} ~@[~S~] ~A") +(defvar *ld-format* #-msvc "~A -o ~S -L~S ~{~S ~} ~@[~S~]~{ '~A'~} ~A" + #+msvc "~A -Fe~S~* ~{~S ~} ~@[~S~]~{ '~A'~} ~A") -(defvar *cc-format* #-msvc "~A \"-I~A\" ~A ~:[~*~;~A~] -w -c \"~A\" -o \"~A\"" - #+msvc "~A -I\"~A\" ~A ~:[~*~;~A~] -w -c \"~A\" -Fo\"~A\"") +(defvar *cc-format* #-msvc "~A \"-I~A\" ~A ~:[~*~;~A~] -w -c \"~A\" -o \"~A\"~{ '~A'~}" + #+msvc "~A -I\"~A\" ~A ~:[~*~;~A~] -w -c \"~A\" -Fo\"~A\"~{ '~A'~}") #-dlopen (defvar *ld-flags* "@LDFLAGS@ -lecl @CORE_LIBS@ @FASL_LIBS@ @LIBS@") @@ -471,6 +473,16 @@ coprocessor).") (defvar *ld-bundle-flags* #-msvc "@BUNDLE_LDFLAGS@ @LDFLAGS@ -lecl @FASL_LIBS@ @LIBS@" #+msvc "@BUNDLE_LDFLAGS@ @LDFLAGS@ ecl.lib @CLIBS@") +(defvar *user-ld-flags* '() +"Flags and options to be passed to the linker when building FASL, shared libraries +and standalone programs. It is not required to surround values with quotes or use +slashes before special characters.") + +(defvar *user-cc-flags* '() +"Flags and options to be passed to the C compiler when building FASL, shared libraries +and standalone programs. It is not required to surround values with quotes or use +slashes before special characters.") + (defvar +shared-library-prefix+ "@SHAREDPREFIX@") (defvar +shared-library-extension+ "@SHAREDEXT@") (defvar +shared-library-format+ "@SHAREDPREFIX@~a.@SHAREDEXT@") diff --git a/src/cmp/cmpmain.lsp b/src/cmp/cmpmain.lsp index 83888ba8f..6b99d1c88 100755 --- a/src/cmp/cmpmain.lsp +++ b/src/cmp/cmpmain.lsp @@ -116,6 +116,7 @@ the environment variable TMPDIR to a different value." template))) (fix-for-mingw (ecl-library-directory)) options *ld-rpath* + *user-ld-flags* *ld-flags*)) #+msvc (embed-manifest-file o-pathname :program) @@ -146,6 +147,7 @@ the environment variable TMPDIR to a different value." template))) (fix-for-mingw (ecl-library-directory)) options *ld-rpath* + *user-ld-flags* (dll-extra-flags o-pathname))) #+msvc (embed-manifest-file o-pathname :dll) @@ -155,11 +157,12 @@ the environment variable TMPDIR to a different value." template))) (let ((lib-file (compile-file-pathname o-pathname :type :lib))) (safe-system (format nil - "gcc -shared -o ~S -L~S ~{~S ~} ~@[~S~] ~@?" + "gcc -shared -o ~S -L~S ~{~S ~} ~@[~S~]~{ '~A'~} ~@?" (si::coerce-to-filename o-pathname) (fix-for-mingw (ecl-library-directory)) options *ld-rpath* + *user-ld-flags* *ld-shared-flags*)))) #+dlopen @@ -188,6 +191,7 @@ the environment variable TMPDIR to a different value." template))) (fix-for-mingw (ecl-library-directory)) options *ld-rpath* + *user-ld-flags* (bundle-extra-flags init-name o-pathname))) #+msvc (embed-manifest-file o-pathname :fasl) @@ -196,11 +200,12 @@ the environment variable TMPDIR to a different value." template))) #+(or mingw32) (safe-system (format nil - "gcc -shared -o ~S -Wl,--export-all-symbols -L~S ~{~S ~} ~@[~S~] ~A" + "gcc -shared -o ~S -Wl,--export-all-symbols -L~S ~{~S ~} ~@[~S~]~{ '~A'~} ~A" (si::coerce-to-filename o-pathname) (fix-for-mingw (ecl-library-directory)) options *ld-rpath* + *user-ld-flags* *ld-bundle-flags*))) (defconstant +lisp-program-header+ " @@ -922,7 +927,8 @@ from the C language code. NIL means \"do not create the file\"." (fix-for-mingw (ecl-include-directory)) *cc-flags* (>= (cmp-env-optimization 'speed) 2) *cc-optimize* (si::coerce-to-filename c-pathname) - (si::coerce-to-filename o-pathname)) + (si::coerce-to-filename o-pathname) + *user-cc-flags*) ; Since the SUN4 assembler loops with big files, you might want to use this: ; (format nil ; "~A ~@[~*-O1~] -S -I. -I~A -w ~A ; as -o ~A ~A"