+#else /* OMIT_NATIVE_CODEGEN */
+
+ = pprPanic "This compiler was built without a native code generator"
+ (text "Use -fvia-C instead")
+
+#endif
+\end{code}
+
+
+%************************************************************************
+%* *
+\subsection{Java}
+%* *
+%************************************************************************
+
+\begin{code}
+#ifdef JAVA
+outputJava dflags filenm mod tycons core_binds
+ = doOutput filenm (\ f -> printForUser f alwaysQualify pp_java)
+ -- User style printing for now to keep indentation
+ where
+ occ_anal_binds = occurAnalyseBinds core_binds
+ -- Make sure we have up to date dead-var information
+ java_code = javaGen mod [{- Should be imports-}] tycons occ_anal_binds
+ pp_java = PrintJava.compilationUnit java_code
+#endif
+\end{code}
+
+
+%************************************************************************
+%* *
+\subsection{Ilx}
+%* *
+%************************************************************************
+
+\begin{code}
+#ifdef ILX
+outputIlx dflags filename mod tycons stg_binds
+ = doOutput filename (\ f -> printForC f pp_ilx)
+ where
+ pp_ilx = ilxGen mod tycons stg_binds
+#endif
+\end{code}
+
+
+%************************************************************************
+%* *
+\subsection{Foreign import/export}
+%* *
+%************************************************************************
+
+\begin{code}
+outputForeignStubs :: DynFlags -> ForeignStubs
+ -> IO (Bool, -- Header file created
+ Bool) -- C file created
+outputForeignStubs dflags NoStubs = do
+-- When compiling External Core files, may need to use stub files from a
+-- previous compilation
+ hFileExists <- doesFileExist (hscStubHOutName dflags)
+ cFileExists <- doesFileExist (hscStubCOutName dflags)
+ return (hFileExists, cFileExists)
+outputForeignStubs dflags (ForeignStubs h_code c_code _ _)
+ = do
+ dumpIfSet_dyn dflags Opt_D_dump_foreign
+ "Foreign export header file" stub_h_output_d
+
+ -- we need the #includes from the rts package for the stub files
+ let rtsid = rtsPackageId (pkgState dflags)
+ rts_includes
+ | ExtPackage pid <- rtsid =
+ let rts_pkg = getPackageDetails (pkgState dflags) pid in
+ concatMap mk_include (includes rts_pkg)
+ | otherwise = []
+ mk_include i = "#include \"" ++ i ++ "\"\n"
+
+ stub_h_file_exists
+ <- outputForeignStubs_help (hscStubHOutName dflags) stub_h_output_w
+ ("#include \"HsFFI.h\"\n" ++ cplusplus_hdr) cplusplus_ftr
+
+ dumpIfSet_dyn dflags Opt_D_dump_foreign
+ "Foreign export stubs" stub_c_output_d
+
+ stub_c_file_exists
+ <- outputForeignStubs_help (hscStubCOutName dflags) stub_c_output_w
+ ("#define IN_STG_CODE 0\n" ++
+ "#include \"Rts.h\"\n" ++
+ rts_includes ++
+ cplusplus_hdr)
+ cplusplus_ftr
+ -- We're adding the default hc_header to the stub file, but this
+ -- isn't really HC code, so we need to define IN_STG_CODE==0 to
+ -- avoid the register variables etc. being enabled.
+
+ return (stub_h_file_exists, stub_c_file_exists)
+ where