+
+#---------- user defined prelude ---------------------------------------
+
+if (grep(/^-user-prelude$/, @ARGV)) {
+
+ # If ARGV contains -user-prelude we are compiling a piece of
+ # prelude for the user, probably with additional specialise pragmas
+
+ # We strip out the -O -f and -user-prelude flags provided on
+ # the command line and add the ones used to compile the prelude
+ # ToDo: get these options from a common definition in mkworld
+
+ # We also enable any options forced through with -user-prelude-force
+
+ # Hey, Check out this grep statement ;-) (PS)
+
+ @ARGV = grep((!/^-O/ && !/^-f/ && !/^-user-prelude$/) || s/^-user-prelude-force//,
+ @ARGV);
+
+ unshift(@ARGV,
+ '-prelude',
+ '-O',
+ '-fshow-pragma-name-errs',
+ '-fshow-import-specs',
+ '-fomit-reexported-instances',
+ '-fglasgow-exts',
+ '-genSPECS',
+ '-DUSE_FOLDR_BUILD',
+ '-dcore-lint');
+
+ print STDERR "ghc: -user-prelude options:\n", "@ARGV", "\n";
+}
+