[project @ 1997-12-04 15:01:06 by simonm]
[ghc-hetmet.git] / ghc / driver / ghc.lprl
index 54e3db1..ef32980 100644 (file)
@@ -271,18 +271,24 @@ Warning packages that are controlled by -W and -Wall.  The 'standard'
 warnings that you get all the time are
        
        -fwarn-overlapping-patterns
-       -fwarn-incomplete-patterns
+       -fwarn-missing-methods
+       -fwarn-duplicate-exports
 
 these are turned off by -Wnot.
 
 \begin{code}
 @StandardWarnings = ('-fwarn-overlapping-patterns', 
-                    '-fwarn-incomplete-patterns');
-@MinusWOpts    = (@StandardWarnings, '-fwarn-name-shadowing');
-@MinusWallOpts = @MinusWOpts;
+                    '-fwarn-missing-methods',
+                    '-fwarn-duplicate-exports');
+@MinusWOpts              = (@StandardWarnings, 
+                    '-fwarn-incomplete-patterns', 
+                    '-fwarn-unused-names');
+@MinusWallOpts           = (@MinusWOpts, 
+                    '-fwarn-name-shadowing');
 \end{code}
 
 What options \tr{-user-setup-a} turn into (user-defined ``packages''
+
 of options).  Note that a particular user-setup implies a particular
 Prelude ({\em including} its interface file(s)).
 \begin{code}
@@ -573,6 +579,10 @@ if (  $Status == 0 && $Only_generate_deps ) {
     push (@MkDependHS_flags, "-o$Osuffix") if $Osuffix;
     push (@MkDependHS_flags, "-s$BuildTag") if $BuildTag;
     push (@MkDependHS_flags, "-D__HASKELL1__=$Haskell1Version");
+    # They're not (currently) needed, but we need to quote any -#include options
+    foreach (@Cmd_opts) {
+       s/-#include.*$/'$&'/g;
+    };
     local($to_do) = "$MkDependHS @MkDependHS_flags -- @Cmd_opts -- @Input_file" ;
     &run_something($to_do, 'Haskell dependencies');
     exit $Status;
@@ -2410,6 +2420,25 @@ sub add_Hsc_flags {
 }
 \end{code}
 
+\begin{code}
+sub add_syslib {
+    local($syslib) = @_;
+    
+    unshift(@SysImport_dir,
+           ${INSTALLING} ? "$InstSysLibDir/$syslib/imports"
+                         : "$TopPwd/hslibs/$syslib/src");
+
+    push(@SysLibrary_dir,
+        ${INSTALLING} ? ("$InstSysLibDir")
+                       : ("$TopPwd/hslibs/$syslib",
+                         "$TopPwd/hslibs/$syslib/cbits"));
+
+    push(@SysLibrary, "-lHS$syslib");
+    push(@SysLibrary, "-lHS${syslib}_cbits")
+          unless $syslib eq 'contrib'; #HACK! it has no cbits
+}
+\end{code}
+
 Source files may have {-# OPTIONS ... #-} pragmas at the top, containing
 command line options we want to append to collection of commands specified
 directly. @check_for_source_options@ looks at the top of a de-lit'ified Haskell
@@ -2753,24 +2782,21 @@ arg: while($_ = $Args[0]) {
                            print STDERR "$Pgm: no such system library (-syslib): $syslib\n",
                              $Status++ unless $syslib =~ /^(hbc|ghc|posix|contrib)$/;
 
-                           unshift(@SysImport_dir,
-                               ${INSTALLING}
-                               ? "$InstSysLibDir/$syslib/imports"
-                               : "$TopPwd/hslibs/$syslib/src");
-
-                           if ( ${INSTALLING} ) {
-                               push(@SysLibrary_dir,
-                                       ("$InstSysLibDir"));
-                           } else {
-                               push(@SysLibrary_dir,
-                                       ("$TopPwd/hslibs/$syslib"
-                                       ,"$TopPwd/hslibs/$syslib/cbits"));
+                           #
+                           # The posix library is a `special' in that it relies on
+                           # the ghc system library (packed strings). Wielding our
+                           # sledgehammer, the problem is solved by silently including
+                           # the ghc system library as well.
+                           # (ToDo: `nub' -syslib list)
+                           #
+                           &add_syslib($syslib);
+                           if ( $syslib eq 'posix' ) {
+                               &add_syslib('ghc');
+                           } elsif ( $syslib eq 'ghc' && 
+                                     $TargetName =~ /-solaris2$/ ) {
+                               # needed for Berkeley socket/nwork stuff.
+                               push(@SysLibrary, '-lnsl');
                            }
-
-                           push(@SysLibrary, "-lHS$syslib");
-                           push(@SysLibrary, "-lHS${syslib}_cbits")
-                             unless $syslib eq 'contrib'; #HACK! it has no cbits
-
                            next arg; };
 
     #=======================================================================
@@ -2947,7 +2973,10 @@ arg: while($_ = $Args[0]) {
     /^-fshow-import-specs/
                    && do { push(@HsC_flags, $_); next arg; };
 
-    /^-fwarn-(.*)$/      && do { push(@HsC_flags, $_);   next arg; };
+    /^-fsignatures-required/      
+                   && do { push(@HsC_flags, $_); next arg; };
+
+    /^-fwarn-(.*)$/      && do { push(@HsC_flags, $_); next arg; };
 
     /^-fno-(.*)$/   && do { push(@HsC_antiflags, "-f$1");
                            &squashHscFlag("-f$1");
@@ -2955,7 +2984,7 @@ arg: while($_ = $Args[0]) {
 
     /^-W$/         && do { push(@HsC_flags, @MinusWOpts); next arg; };
     /^-Wall$/      && do { push(@HsC_flags, @MinusWallOpts); next arg; };
-    /^-Wnot$/       && do { foreach (@Hsc_flags) {
+    /^(-Wnot|w)$/   && do { foreach (@Hsc_flags) {
                                /^-fwarn-(.*)$/ && do { $_=''; };
                            };
                            push(@HsC_antiflags, @StandardWarnings);