COBOL searches for copybooks in the compiler, not the driver.
COBOL frontend now handles copybook path searches directly, aligning with Modula-2 and supporting `-B` and `-idirafter`.
The COBOL frontend, cobol1, now manages copybook path searches internally, rather than relying on the gcobol driver. This change mirrors the behavior of the Modula-2 frontend, allowing cobol1 to honor options like -B and -idirafter for specifying search paths. This provides more consistent and flexible control over how copybooks are located during compilation.
In Details
The change concerns the cobol1 frontend and its handling of search paths for COBOL copybooks. Previously, the gcobol driver managed these paths. This commit shifts responsibility to cobol1.cc, implementing functions like libcompat_copybook and append_copybook_prefix, and extending cobol_langhook_handle_option and cobol_langhook_post_options to process -B and -idirafter. This aligns with LANG_HOOKS_POST_OPTIONS usage seen in other frontends.
For Context
Compilers like GCC (GNU Compiler Collection) often break down into multiple parts, including a 'driver' that orchestrates the overall compilation process, and 'frontends' that handle specific programming languages. For COBOL, source code often includes 'copybooks,' which are external files containing reusable code or data definitions. This commit moves the responsibility of finding these copybooks from the gcobol driver to the cobol1 COBOL-specific frontend. This makes the COBOL compiler behave more like other language frontends, such as the one for Modula-2. Developers can now use compiler options like -B and -idirafter directly with the COBOL compiler to specify where to look for these copybooks, giving them more control over the compilation environment.